plandex-ai/plandex · error
error unmarshalling description file %s: %v
Error message
error unmarshalling description file %s: %v
What it means
GetConvoMessageDescriptions reads description JSON files from a results directory in parallel goroutines. This error wraps the json.Unmarshal failure for one file, carrying the file path and underlying parse error so the caller can identify which description file is corrupt.
Source
Thrown at app/server/db/result_helpers.go:352
}()
path := filepath.Join(descriptionsDir, file.Name())
bytes, err := os.ReadFile(path)
if err != nil {
errCh <- fmt.Errorf("error reading description file %s: %v", file.Name(), err)
return
}
var description ConvoMessageDescription
err = json.Unmarshal(bytes, &description)
if err != nil {
log.Println("Error unmarshalling description file:", path)
log.Println("bytes:")
log.Println(string(bytes))
errCh <- fmt.Errorf("error unmarshalling description file %s: %v", path, err)
return
}
descCh <- &description
}(file)
}
for i := 0; i < len(files); i++ {
select {
case err := <-errCh:
return nil, fmt.Errorf("error reading description files: %v", err)
case description := <-descCh:
if description.WroteFiles && description.AppliedAt == nil {
descriptions = append(descriptions, description)
}
}
}
View on GitHub (pinned to e2d772072e)
Solutions
- Inspect the logged file contents (path and bytes are printed) to find the JSON syntax problem
- Delete or repair the corrupt description file in the plan results directory and re-run
- Validate all description files with a JSON linter / jq before processing
- Restore files from backup or regenerate them by re-running the plan
Example fix
// before: corrupt file silently blocks everything
// after: skip unparseable files instead of failing the batch
if err := json.Unmarshal(bytes, &description); err != nil {
log.Printf("skipping malformed description file %s: %v", path, err)
return
} Defensive patterns
Strategy: validation
Validate before calling
import "encoding/json"
func isValidJSONFile(path string) error {
b, err := os.ReadFile(path)
if err != nil { return err }
var v any
return json.Unmarshal(b, &v)
} Try / catch
descs, err := db.GetConvoMessageDescriptions(...)
if err != nil {
if strings.Contains(err.Error(), "error unmarshalling description file") {
// extract path from err and repair/quarantine the file
}
return err
} Prevention
- Write description files atomically (temp file + rename)
- Run a JSON lint over the results directory in CI
- Never hand-edit stored JSON; regenerate via the tooling
When it happens
Trigger: A description file in getPlanResultsDir contains invalid JSON (truncated write, manual edit, non-UTF8 bytes, or a schema change that no longer matches the description struct).
Common situations: Interrupted process mid-write leaving partial JSON; manual editing of result files; older description files written by a previous version whose fields changed shape.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- error reading convo files: %v
- panic in GetConvoMessageDescriptions: %v\n%s
- error reading description files: %v
- error unmarshalling result file: %v
- refresh failed - marshal: %w
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/b64eec1c1268b0f0.
Report an issue: GitHub.