{"record":{"id":"3271d4d102d97c4b","repo":"zed-industries/zed","slug":"schema-cannot-be-made-compatible-because-it-contai","errorCode":null,"errorMessage":"Schema cannot be made compatible because it contains \"{key}\"","messagePattern":"Schema cannot be made compatible because it contains \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/language_model_core/src/tool_schema.rs","lineNumber":208,"sourceCode":"/// definition was looked up under, and `name` is the definition name.\nfn parse_ref(ref_str: &str) -> Result<(&'static str, &str)> {\n    if let Some(name) = ref_str.strip_prefix(\"#/$defs/\") {\n        return Ok((\"$defs\", name));\n    }\n    if let Some(name) = ref_str.strip_prefix(\"#/definitions/\") {\n        return Ok((\"definitions\", name));\n    }\n    anyhow::bail!(\n        \"Unsupported $ref format (only `#/$defs/<name>` and `#/definitions/<name>` are supported): {ref_str}\"\n    );\n}\n\nfn adapt_to_json_schema_subset(json: &mut Value) -> Result<()> {\n    if let Value::Object(obj) = json {\n        const UNSUPPORTED_KEYS: [&str; 4] = [\"if\", \"then\", \"else\", \"$ref\"];\n\n        for key in UNSUPPORTED_KEYS {\n            anyhow::ensure!(\n                !obj.contains_key(key),\n                \"Schema cannot be made compatible because it contains \\\"{key}\\\"\"\n            );\n        }\n\n        const KEYS_TO_REMOVE: [(&str, fn(&Value) -> bool); 6] = [\n            (\"format\", |value| value.is_string()),\n            (\"additionalProperties\", |_| true),\n            (\"propertyNames\", |_| true),\n            (\"exclusiveMinimum\", |value| value.is_number()),\n            (\"exclusiveMaximum\", |value| value.is_number()),\n            (\"optional\", |value| value.is_boolean()),\n        ];\n        for (key, predicate) in KEYS_TO_REMOVE {\n            if let Some(value) = obj.get(key)\n                && predicate(value)\n            {\n                obj.remove(key);","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/language_model_core/src/tool_schema.rs#L190-L226","documentation":"Raised while adapting a tool's JSON schema to the subset providers accept: the schema contains construct \"{key}\" that cannot be translated (an unresolvable or unsupported $ref form or equivalent), so making it compatible would require rewriting semantics the adapter doesn't support. Per the adapter's contract the schema is left untouched rather than half-rewritten, and the caller receives this error; typically the tool's schema generator (e.g. pydantic or zod-to-json-schema) emitted a reference format outside `#/$defs/<name>` and `#/definitions/<name>`.","triggerScenarios":"Thrown at crates/language_model_core/src/tool_schema.rs:208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the tool's schema generator settings so references are inlined (e.g. schemars inline_subschemas) instead of emitted","Ensure $ref values use `#/$defs/<name>` or `#/definitions/<name>` forms only","Remove exotic JSON Schema keywords the provider subset doesn't support from the tool definition","On this error, send the schema unchanged and let the provider report the specific incompatibility"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}