{"record":{"id":"faf8497b13927f18","repo":"gastownhall/beads","slug":"dependency-s-s-uses-unsupported-metadata-or-t","errorCode":null,"errorMessage":"dependency %s -> %s uses unsupported metadata or thread ID","messagePattern":"dependency (.+?) -> (.+?) uses unsupported metadata or thread ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/migration/legacysqlite/reader.go","lineNumber":923,"sourceCode":"\t\treturn fmt.Errorf(\"orphan dependency %s -> %s\", id, to)\n\t}\n\tif issue.Ephemeral != byID[to].Ephemeral {\n\t\treturn fmt.Errorf(\"dependency %s -> %s crosses ephemeral storage\", id, to)\n\t}\n\tkey := id + \"\\x00\" + to\n\tif seenDeps[key] {\n\t\treturn fmt.Errorf(\"multiple legacy dependencies for %s -> %s\", id, to)\n\t}\n\tseenDeps[key] = true\n\tcreated, e := parseTime(at)\n\tif e != nil {\n\t\treturn e\n\t}\n\tif created.IsZero() {\n\t\treturn fmt.Errorf(\"dependency created_at is zero for %s -> %s\", id, to)\n\t}\n\tif (metadata.Valid && metadata.String != \"\") || (thread.Valid && thread.String != \"\") {\n\t\treturn fmt.Errorf(\"dependency %s -> %s uses unsupported metadata or thread ID\", id, to)\n\t}\n\tif !types.DependencyType(typ).IsValid() {\n\t\treturn fmt.Errorf(\"dependency %s -> %s has invalid type\", id, to)\n\t}\n\td := &types.Dependency{IssueID: id, DependsOnID: to, Type: types.DependencyType(typ), CreatedAt: created, CreatedBy: by, Metadata: nullString(metadata), ThreadID: nullString(thread)}\n\tissue.Dependencies = append(issue.Dependencies, d)\n\treturn nil\n}\n\nfunc loadComments(ctx context.Context, db *sql.Tx, byID map[string]*types.Issue) error {\n\tcomments, err := db.QueryContext(ctx, \"SELECT id,issue_id,author,text,CAST(created_at AS TEXT) FROM comments ORDER BY issue_id,created_at,id\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer comments.Close()\n\ttype commentIdentity struct {\n\t\tissueID, author, text string\n\t\tcreatedAt             time.Time","sourceCodeStart":905,"sourceCodeEnd":941,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/migration/legacysqlite/reader.go#L905-L941","documentation":"The current bd dependency model does not support per-dependency metadata or thread IDs, so the legacy importer refuses to bring in rows that carry them. Any dependency whose metadata or thread_id column is non-empty (and valid) aborts migration for that database.","triggerScenarios":"Legacy SQLite dependency rows with non-empty metadata and/or thread_id columns; the reader checks `metadata.Valid && metadata.String != \"\"` and likewise for thread before appending the Dependency.","commonSituations":"Legacy databases produced by experimental/newer builds that wrote dependency metadata or thread IDs; manually edited rows; schema drift between legacy versions.","solutions":["Clear the unsupported columns in the legacy DB: UPDATE dependencies SET metadata = NULL, thread_id = NULL where they are non-empty","If the metadata/thread info matters, record it elsewhere (issue notes) before clearing","Migrate with a reader version that matches the legacy schema, or drop the rows entirely"],"exampleFix":"-- before\n-- dependency row has metadata='{\"priority\":1}'\nUPDATE dependencies SET metadata = NULL, thread_id = NULL;\n-- after: importer accepts the row","handlingStrategy":"validation","validationCode":"for (const d of legacyDeps) {\n  if ((d.metadata && d.metadata !== '') || (d.thread_id && d.thread_id !== ''))\n    throw new Error(`unsupported metadata/thread on ${d.issue_id} -> ${d.depends_on_id}`);\n}","typeGuard":"function isPlainDependency(d) {\n  return (!d.metadata || d.metadata === '') && (!d.thread_id || d.thread_id === '');\n}","tryCatchPattern":"try { migrateLegacySQLite(dbPath) } catch (e) {\n  if (e.message.includes('unsupported metadata or thread')) {\n    clearDepMetadataColumns(dbPath); // SET metadata=NULL, thread_id=NULL\n    retry();\n  } else throw e;\n}","preventionTips":["NULL out metadata/thread_id on dependency rows before migrating","Record any needed metadata in issue notes first — the current model drops it","Keep the legacy DB schema aligned with the reader version you migrate with"],"tags":["migration","sqlite","schema-compatibility"],"backgroundTag":"unsupported-dependency-metadata","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}