plandex-ai/plandex · error
unsupported data type: %T
Error message
unsupported data type: %T
What it means
OrgUserConfig implements sql.Scanner; its Scan only handles []byte, string, and an empty-string special case, and rejects everything else (including nil/NULL) with this error. It fires when the DB column value isn't JSON text.
Source
Thrown at app/shared/org_user_config.go:46
if src == nil {
*p = OrgUserConfig{}
return nil
}
switch s := src.(type) {
case []byte:
if len(s) == 0 {
*p = OrgUserConfig{}
return nil
}
return json.Unmarshal(s, p)
case string:
if s == "" {
*p = OrgUserConfig{}
return nil
}
return json.Unmarshal([]byte(s), p)
default:
return fmt.Errorf("unsupported data type: %T", src)
}
}
func (p *OrgUserConfig) Value() (driver.Value, error) {
if p == nil {
return nil, nil
}
return json.Marshal(p)
}
View on GitHub (pinned to e2d772072e)
Solutions
- COALESCE the column in SQL so NULL never reaches Scan.
- Add a nil case assigning OrgUserConfig{} before the default branch.
- Confirm the column type is JSONB/TEXT so the driver yields []byte/string.
- Audit ORM/struct tags to make sure Scan is bound to the right column.
Example fix
// before
default:
return fmt.Errorf("unsupported data type: %T", src)
// after
case nil:
*p = OrgUserConfig{}
return nil
default:
return fmt.Errorf("unsupported data type: %T", src) Defensive patterns
Strategy: type-guard
Validate before calling
var cfg OrgUserConfig
err := db.QueryRow("SELECT COALESCE(org_user_config, '{}'::jsonb) FROM org_users WHERE id=$1", id).Scan(&cfg) Type guard
func scanableColumnValue(src any) bool {
switch src.(type) {
case []byte, string:
return true
default:
return false
}
} Try / catch
var cfg OrgUserConfig
if err := rows.Scan(&cfg); err != nil {
if strings.Contains(err.Error(), "unsupported data type") {
cfg = OrgUserConfig{} // zero-value fallback
} else {
return err
}
} Prevention
- Add a nil branch to OrgUserConfig.Scan.
- Apply NOT NULL DEFAULT '{}' to org_user_config columns.
- COALESCE the column in raw SQL selects.
- Test Scan paths for NULL, empty string, and valid JSON.
When it happens
Trigger: Scanning a NULL org_user_config column (driver passes nil -> default branch); driver returning non-text types for the column; wrong column mapped to the OrgUserConfig field.
Common situations: Rows created before the config column was populated (NULL defaults); schema or driver changes altering the delivered Go type; ORM mapping mistakes pointing Scan at an int/bool column.
Related errors
- unsupported data type: %T
- unsupported data type: %T
- unsupported data type: %T
- unsupported data type: %T
- error invalidating conflicted results: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/70d64a05e8509a3a.
Report an issue: GitHub.