{"record":{"id":"c7dbbbfcabd4a91e","repo":"plandex-ai/plandex","slug":"error-parsing-embedded-schema-s-v","errorCode":null,"errorMessage":"error parsing embedded schema %s: %v","messagePattern":"error parsing embedded schema (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/schema/schemas.go","lineNumber":119,"sourceCode":"\tif strings.HasPrefix(source, webPrefix) {\n\t\tsource = path.Join(\"json-schemas\", strings.TrimPrefix(source, webPrefix))\n\t}\n\n\tif strings.HasSuffix(source, \".schema.json\") {\n\t\tschemaPath := source\n\t\t// for schemas with relative path references, add the json-schemas prefix\n\t\tif !strings.HasPrefix(schemaPath, \"json-schemas/\") {\n\t\t\tschemaPath = path.Join(\"json-schemas\", schemaPath)\n\t\t}\n\t\tdata, err := l.fs.ReadFile(schemaPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error reading embedded schema %s: %v\", schemaPath, err)\n\t\t}\n\t\tvar v interface{}\n\t\tdec := json.NewDecoder(bytes.NewReader(data))\n\t\tdec.UseNumber() // use numbers instead of floats\n\t\tif err := dec.Decode(&v); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing embedded schema %s: %v\", source, err)\n\t\t}\n\t\treturn v, nil\n\t}\n\n\tvar v interface{}\n\tdec := json.NewDecoder(bytes.NewReader([]byte(source)))\n\tdec.UseNumber() // use numbers instead of floats\n\tif err := dec.Decode(&v); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing schema JSON: %v\", err)\n\t}\n\treturn v, nil\n}\n\nfunc (l *embeddedSchemaLoader) JsonReference() (gojsonreference.JsonReference, error) {\n\treturn gojsonreference.NewJsonReference(scheme + l.source)\n}\n\ntype embeddedLoaderFactory struct{}","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/schema/schemas.go#L101-L137","documentation":"LoadJSON successfully read the embedded schema file but json.Decoder.Decode failed to parse its contents as JSON. This indicates the embedded schema file itself is malformed, or the wrong (non-JSON) file was embedded at that path.","triggerScenarios":"The file at json-schemas/<schemaPath> contains invalid JSON: truncated file, merge-conflict markers committed into the schema, YAML saved with a .json extension, or non-UTF-8 bytes.","commonSituations":"A schema edit was committed with syntax errors; a bad merge left <<<<<<< markers in the schema file; build-time embedding picked up a draft/broken version.","solutions":["Validate the schema file with jq or a JSON linter and fix the syntax","Remove merge-conflict markers from the schema file","Rebuild to ensure the correct schema version is embedded","Restore the schema file from a known-good commit"],"exampleFix":"// before (schema file)\n{\"type\": \"object\", <<<<<<< HEAD\n// after\n{\"type\": \"object\", \"properties\": {}}","handlingStrategy":"validation","validationCode":"func schemaFileValid(p string) error {\n    data, err := os.ReadFile(p)\n    if err != nil { return err }\n    var v interface{}\n    return json.Unmarshal(data, &v)\n}\n// run against json-schemas/*.json in CI before embedding","typeGuard":null,"tryCatchPattern":"err := validateJSON[T](data, schemaPath)\nif err != nil && strings.Contains(err.Error(), \"error parsing embedded schema\") {\n    // embedded asset corrupt: surface schema path and suggest rebuild\n    return fmt.Errorf(\"embedded schema corrupt: %w\", err)\n}","preventionTips":["Add CI validation of all json-schemas/*.json files","Reject commits containing merge-conflict markers via pre-commit hooks","Never store YAML or drafts under a .json extension"],"tags":["json","schema","parsing"],"backgroundTag":"invalid-json","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}