{"record":{"id":"b64eec1c1268b0f0","repo":"plandex-ai/plandex","slug":"error-unmarshalling-description-file-s-v","errorCode":null,"errorMessage":"error unmarshalling description file %s: %v","messagePattern":"error unmarshalling description file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/db/result_helpers.go","lineNumber":352,"sourceCode":"\t\t\t}()\n\t\t\tpath := filepath.Join(descriptionsDir, file.Name())\n\n\t\t\tbytes, err := os.ReadFile(path)\n\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error reading description file %s: %v\", file.Name(), err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar description ConvoMessageDescription\n\t\t\terr = json.Unmarshal(bytes, &description)\n\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Error unmarshalling description file:\", path)\n\t\t\t\tlog.Println(\"bytes:\")\n\t\t\t\tlog.Println(string(bytes))\n\n\t\t\t\terrCh <- fmt.Errorf(\"error unmarshalling description file %s: %v\", path, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdescCh <- &description\n\t\t}(file)\n\t}\n\n\tfor i := 0; i < len(files); i++ {\n\t\tselect {\n\t\tcase err := <-errCh:\n\t\t\treturn nil, fmt.Errorf(\"error reading description files: %v\", err)\n\t\tcase description := <-descCh:\n\t\t\tif description.WroteFiles && description.AppliedAt == nil {\n\t\t\t\tdescriptions = append(descriptions, description)\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/db/result_helpers.go#L334-L370","documentation":"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.","triggerScenarios":"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).","commonSituations":"Interrupted process mid-write leaving partial JSON; manual editing of result files; older description files written by a previous version whose fields changed shape.","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"],"exampleFix":"// before: corrupt file silently blocks everything\n// after: skip unparseable files instead of failing the batch\nif err := json.Unmarshal(bytes, &description); err != nil {\n    log.Printf(\"skipping malformed description file %s: %v\", path, err)\n    return\n}","handlingStrategy":"validation","validationCode":"import \"encoding/json\"\n\nfunc isValidJSONFile(path string) error {\n    b, err := os.ReadFile(path)\n    if err != nil { return err }\n    var v any\n    return json.Unmarshal(b, &v)\n}","typeGuard":null,"tryCatchPattern":"descs, err := db.GetConvoMessageDescriptions(...)\nif err != nil {\n    if strings.Contains(err.Error(), \"error unmarshalling description file\") {\n        // extract path from err and repair/quarantine the file\n    }\n    return err\n}","preventionTips":["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"],"tags":["go","json","file-parsing","concurrency"],"backgroundTag":"json-unmarshal-failed","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"}