plandex-ai/plandex · error
error reading embedded schema %s: %v
Error message
error reading embedded schema %s: %v
What it means
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.
Source
Thrown at app/cli/schema/schemas.go:113
// remove both "./" and the scheme prefix
source := strings.TrimPrefix(l.source, "./")
source = strings.TrimPrefix(source, scheme)
// convert absolute Plandex URLs to our embed path
const webPrefix = "https://plandex.ai/schemas/"
if strings.HasPrefix(source, webPrefix) {
source = path.Join("json-schemas", strings.TrimPrefix(source, webPrefix))
}
if strings.HasSuffix(source, ".schema.json") {
schemaPath := source
// for schemas with relative path references, add the json-schemas prefix
if !strings.HasPrefix(schemaPath, "json-schemas/") {
schemaPath = path.Join("json-schemas", schemaPath)
}
data, err := l.fs.ReadFile(schemaPath)
if err != nil {
return nil, fmt.Errorf("error reading embedded schema %s: %v", schemaPath, err)
}
var v interface{}
dec := json.NewDecoder(bytes.NewReader(data))
dec.UseNumber() // use numbers instead of floats
if err := dec.Decode(&v); err != nil {
return nil, fmt.Errorf("error parsing embedded schema %s: %v", source, err)
}
return v, nil
}
var v interface{}
dec := json.NewDecoder(bytes.NewReader([]byte(source)))
dec.UseNumber() // use numbers instead of floats
if err := dec.Decode(&v); err != nil {
return nil, fmt.Errorf("error parsing schema JSON: %v", err)
}
return v, nil
}View on GitHub (pinned to e2d772072e)
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
Example fix
// before
newEmbeddedSchemaLoader(SchemaPath("model-packs.json")) // missing file
// after
newEmbeddedSchemaLoader(SchemaPath("json-schemas/model-pack.json")) // correct embedded path Defensive patterns
Strategy: validation
Validate before calling
func embeddedSchemaExists(fs fs.FS, schemaPath string) bool {
p := schemaPath
if !strings.HasPrefix(p, "json-schemas/") {
p = path.Join("json-schemas", p)
}
_, err := fs.ReadFile(p)
return err == nil
} Type guard
func isValidSchemaPath(fs fs.FS, p string) bool {
_, err := fs.ReadFile(path.Join("json-schemas", strings.TrimPrefix(p, "json-schemas/")))
return err == nil
} Try / catch
err := validateJSON[T](data, schemaPath)
if err != nil && strings.Contains(err.Error(), "error reading embedded schema") {
// list available embedded schemas and fail fast with guidance
return fmt.Errorf("unknown schema %q; rebuild binary with go:embed up to date", schemaPath)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error loading accounts: %v
- error setting auth: %v
- error writing auth: %v
- error writing auth: %v
- error reading accounts.json: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/3167de9c95e62a1e.
Report an issue: GitHub.