plandex-ai/plandex · error

error reading description files: %v

Error message

error reading description files: %v

What it means

GetConvoMessageDescriptions fans out goroutines that report errors on errCh; this is the aggregate wrapper returned to callers when any single description file failed to read or unmarshal. It preserves the inner error (which contains the offending path) via %v.

Source

Thrown at app/server/db/result_helpers.go:363

			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)
			}
		}
	}

	sort.Slice(descriptions, func(i, j int) bool {
		return descriptions[i].CreatedAt.Before(descriptions[j].CreatedAt)
	})

	return descriptions, nil
}

func GetPlanFileResults(orgId, planId string) ([]*PlanFileResult, error) {
	var results []*PlanFileResult

	resultsDir := getPlanResultsDir(orgId, planId)

View on GitHub (pinned to e2d772072e)

Solutions

  1. Fix or remove the specific corrupt description file named in the wrapped error
  2. Quarantine malformed files (move out of results dir) so the listing proceeds
  3. Hardening: log-and-skip bad files instead of failing the entire batch
  4. Check disk state for partial writes (fs errors, ENOSPC)
Defensive patterns

Strategy: try-catch

Validate before calling

files, err := os.ReadDir(dir)
if err == nil {
    for _, f := range files {
        if json.Valid(mustRead(f)) { continue } // flag bad files before calling
        log.Printf("malformed description file: %s", f.Name())
    }
}

Try / catch

descs, err := db.GetConvoMessageDescriptions(...)
if err != nil {
    log.Printf("listing descriptions failed: %v", err)
    return nil, fmt.Errorf("listing descriptions: %w", err)
}

Prevention

When it happens

Trigger: Any goroutine sends on errCh — typically [510] unmarshal failure or a file-read error — while the main loop collects len(files) results.

Common situations: One stale/corrupt file among hundreds of valid ones causes the whole listing call to fail for callers like ClearContext, invalidateConflictedResults, and PendingBuildsByPath.

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


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/91edf8698453dd79. Report an issue: GitHub.