{"record":{"id":"3167de9c95e62a1e","repo":"plandex-ai/plandex","slug":"error-reading-embedded-schema-s-v","errorCode":null,"errorMessage":"error reading embedded schema %s: %v","messagePattern":"error reading embedded schema (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/schema/schemas.go","lineNumber":113,"sourceCode":"\t// remove both \"./\" and the scheme prefix\n\tsource := strings.TrimPrefix(l.source, \"./\")\n\tsource = strings.TrimPrefix(source, scheme)\n\n\t// convert absolute Plandex URLs to our embed path\n\tconst webPrefix = \"https://plandex.ai/schemas/\"\n\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}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/schema/schemas.go#L95-L131","documentation":"The embedded schema loader resolves schemaPath within an embedded filesystem (prefixed with json-schemas/ when relative). LoadJSON returns this error when ReadFile on the embedded FS fails — the schema file is missing from the embedded bundle or the path is wrong.","triggerScenarios":"LoadJSON (or newEmbeddedSchemaLoader + validation) is given a SchemaPath that does not exist under json-schemas/ in the embedded FS: typo in schema name, schema not embedded (missing go:embed pattern), or wrong relative path.","commonSituations":"Referring to a newly added schema that wasn't included in go:embed; renaming a schema file without updating callers; stale binary built before the schema was added.","solutions":["Verify the schema file exists under json-schemas/ in the repo and matches schemaPath","Confirm the go:embed directive covers the file (rebuild the binary)","Fix the schemaPath string (typos, wrong extension)","Rebuild/reinstall the CLI so embedded assets are current"],"exampleFix":"// before\nnewEmbeddedSchemaLoader(SchemaPath(\"model-packs.json\")) // missing file\n// after\nnewEmbeddedSchemaLoader(SchemaPath(\"json-schemas/model-pack.json\")) // correct embedded path","handlingStrategy":"validation","validationCode":"func embeddedSchemaExists(fs fs.FS, schemaPath string) bool {\n    p := schemaPath\n    if !strings.HasPrefix(p, \"json-schemas/\") {\n        p = path.Join(\"json-schemas\", p)\n    }\n    _, err := fs.ReadFile(p)\n    return err == nil\n}","typeGuard":"func isValidSchemaPath(fs fs.FS, p string) bool {\n    _, err := fs.ReadFile(path.Join(\"json-schemas\", strings.TrimPrefix(p, \"json-schemas/\")))\n    return err == nil\n}","tryCatchPattern":"err := validateJSON[T](data, schemaPath)\nif err != nil && strings.Contains(err.Error(), \"error reading embedded schema\") {\n    // list available embedded schemas and fail fast with guidance\n    return fmt.Errorf(\"unknown schema %q; rebuild binary with go:embed up to date\", schemaPath)\n}","preventionTips":["Keep go:embed patterns updated when adding schema files","Reference schemas by their exact path under json-schemas/","Rebuild the binary after adding or renaming schemas","Add a startup smoke test that loads all embedded schemas"],"tags":["filesystem","embedded","schema"],"backgroundTag":"embedded-resource-not-found","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}