{
  "id": "kubernetes/kubectl-apply-invalid-yaml-syntax",
  "signature": "error: error validating \"deployment.yaml\": error validating data: [ValidationError(Deployment.spec): unknown field \"replicas\" in io.k8s.api.apps.v1.DeploymentSpec]; if you choose to ignore these errors, turn validation off with --validate=false",
  "signature_zh": "错误：验证 \"deployment.yaml\" 错误：数据验证错误：[ValidationError(Deployment.spec): 在 io.k8s.api.apps.v1.DeploymentSpec 中发现未知字段 \"replicas\"]；如果选择忽略这些错误，请使用 --validate=false 关闭验证",
  "regex": "error validating .*: ValidationError\\(.*\\): unknown field",
  "domain": "kubernetes",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "YAML manifest has a typo or wrong field name (e.g., 'replicas' instead of 'replicas'), causing API validation to reject it.",
  "root_cause_type": "generic",
  "root_cause_zh": "YAML 清单有拼写错误或错误字段名（例如 'replicas' 而非 'replicas'），导致 API 验证拒绝。",
  "versions": [
    {
      "version": "kubectl v1.28",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kubectl v1.29",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kubectl v1.30",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Use --validate=false blindly to bypass validation",
      "why_fails": "Bypasses validation but the field is still invalid; API server will reject with a different error.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Rename the field to something else (e.g., 'count')",
      "why_fails": "Kubernetes API expects exact field names; renaming won't match the schema.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Delete and recreate the YAML file",
      "why_fails": "Recreating doesn't fix the typo; same error will occur.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Correct the typo: change 'replicas' to 'replicas' in deployment.yaml and reapply: `kubectl apply -f deployment.yaml`.",
      "success_rate": 0.95,
      "how": "Correct the typo: change 'replicas' to 'replicas' in deployment.yaml and reapply: `kubectl apply -f deployment.yaml`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `kubectl explain deployment.spec.replicas` to verify correct field name and structure.",
      "success_rate": 0.9,
      "how": "Use `kubectl explain deployment.spec.replicas` to verify correct field name and structure.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Validate YAML offline with `kubectl --dry-run=client -f deployment.yaml` before applying.",
      "success_rate": 0.85,
      "how": "Validate YAML offline with `kubectl --dry-run=client -f deployment.yaml` before applying.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Correct the typo: change 'replicas' to 'replicas' in deployment.yaml and reapply: `kubectl apply -f deployment.yaml`.",
    "Use `kubectl explain deployment.spec.replicas` to verify correct field name and structure.",
    "Validate YAML offline with `kubectl --dry-run=client -f deployment.yaml` before applying."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-validate",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}