plandex-ai/plandex · error
Error scanning project:
Error message
Error scanning project:
What it means
While iterating query rows, rows.Scan(&project.Id, &project.Name) failed to copy the current row's columns into the shared.Project fields. This is a column/type mismatch or a NULL value being scanned into a non-nullable Go type; the handler responds with 500 and the scan error text.
Source
Thrown at app/server/handlers/projects.go:107
return
}
rows, err := db.Conn.Query("SELECT id, name FROM projects WHERE org_id = $1", auth.OrgId)
if err != nil {
log.Printf("Error listing projects: %v\n", err)
http.Error(w, "Error listing projects: "+err.Error(), http.StatusInternalServerError)
return
}
var projects []shared.Project
for rows.Next() {
var project shared.Project
err := rows.Scan(&project.Id, &project.Name)
if err != nil {
log.Printf("Error scanning project: %v\n", err)
http.Error(w, "Error scanning project: "+err.Error(), http.StatusInternalServerError)
return
}
projects = append(projects, project)
}
bytes, err := json.Marshal(projects)
if err != nil {
log.Printf("Error marshalling projects: %v\n", err)
http.Error(w, "Error marshalling projects: "+err.Error(), http.StatusInternalServerError)
return
}
w.Write(bytes)
}
func ProjectSetPlanHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Received request for UpdateProjectSetPlanHandler")
auth := Authenticate(w, r, true)View on GitHub (pinned to e2d772072e)
Solutions
- Read the appended error: 'converting NULL to string is unsupported' means a NULL id/name row exists — clean or backfill the bad row.
- Declare destinations as sql.NullString (or pointers) if NULLs are legitimate.
- Keep the SELECT column list and Scan argument order/count in sync after any schema change.
- Validate that shared.Project.Id/Name types match the actual column types.
Example fix
// before var project shared.Project err := rows.Scan(&project.Id, &project.Name) // after var name sql.NullString err := rows.Scan(&project.Id, &name) project.Name = name.String
Defensive patterns
Strategy: validation
Validate before calling
SELECT id, name FROM projects WHERE org_id = $1 AND id IS NOT NULL AND name IS NOT NULL
Type guard
func scanProject(row *sql.Row) (shared.Project, error) {
var p shared.Project
var name sql.NullString
if err := row.Scan(&p.Id, &name); err != nil {
return p, err
}
p.Name = name.String
return p, nil
} Prevention
- Make NOT NULL constraints on projects.id and projects.name so bad rows can't exist.
- Use COALESCE(name, '') or sql.NullString when NULLs are possible.
- Run a data-quality check after manual imports or migrations.
- Keep SELECT column order and Scan args in sync; add a row-scanning unit test with fixtures.
When it happens
Trigger: GET/POST list-projects with at least one row in projects where the id or name column is NULL, or where the column type doesn't fit the destination (e.g. non-text in name), or the SELECT column order/count was changed without updating Scan.
Common situations: Manual inserts or imports that left name NULL; schema changed (column type altered or reordered) while the hardcoded SELECT/Scan stayed the same; using a driver that returns an unusual type for the column.
Related errors
- Error getting branches:
- Error listing projects:
- Error updating project:
- error creating invite: %v
- error getting invite: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/0fc1b039c61e8b6e.
Report an issue: GitHub.