{"record":{"id":"508f891f50ac1761","repo":"gastownhall/beads","slug":"deferred-parents-s-s-w","errorCode":null,"errorMessage":"deferred parents: %s/%s: %w","messagePattern":"deferred parents: (.+?)/(.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/ready_work.go","lineNumber":115,"sourceCode":"\t\t\tSELECT dep.issue_id\n\t\t\tFROM %s dep\n\t\t\tJOIN %s parent ON parent.id = dep.%s\n\t\t\tWHERE dep.type = 'parent-child'\n\t\t\t  AND parent.defer_until IS NOT NULL\n\t\t\t  AND parent.defer_until > UTC_TIMESTAMP()\n\t\t`, e.depTable, e.issueTable, e.targetCol)\n\t\trows, err := r.runner.QueryContext(ctx, q)\n\t\tif err != nil {\n\t\t\t// Each edge joins a dependency table to an issue table. Only one of\n\t\t\t// the four pairs is entirely durable, but three of them name at\n\t\t\t// least one required table. Classified by error class alone this\n\t\t\t// swallowed the edges naming a missing dependencies or issues and\n\t\t\t// let the rest answer, returning an incomplete set of deferred\n\t\t\t// children with a nil error.\n\t\t\tif missingOptionalWispTable(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"deferred parents: %s/%s: %w\", e.depTable, e.issueTable, err)\n\t\t}\n\t\tif err := scanStringsInto(rows, &childIDs); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"deferred parents: %s/%s: %w\", e.depTable, e.issueTable, err)\n\t\t}\n\t}\n\treturn childIDs, nil\n}\n\nfunc scanStringsInto(rows *sql.Rows, out *[]string) error {\n\tdefer func() { _ = rows.Close() }()\n\tfor rows.Next() {\n\t\tvar s string\n\t\tif err := rows.Scan(&s); err != nil {\n\t\t\treturn fmt.Errorf(\"scan: %w\", err)\n\t\t}\n\t\t*out = append(*out, s)\n\t}\n\treturn rows.Err()","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/ready_work.go#L97-L133","documentation":"Wraps a QueryContext failure from one of the four deferred-parent edge queries in descendantsOfFutureDeferredParents, identified by \"depTable/issueTable\". Missing optional wisp tables are skipped by design, but a failure on any edge naming a required table (e.g. `dependencies`/`issues`) aborts the deferred-children computation. This strictness exists so ready work never returns an incomplete exclusion set with a nil error.","triggerScenarios":"Calling ready work with IncludeDeferred=false when a future deferred parent exists and the edge query `dependencies JOIN issues` (or a wisp-pair edge that is not classified as an optional missing wisp table) fails to execute.","commonSituations":"Schema drift removing or renaming `dependencies`; a wisp-table error that isn't recognized as the optional-missing-table class (version mismatch between code classification and engine error text); connectivity failures.","solutions":["Inspect the wrapped error and the depTable/issueTable pair named in the message","Ensure required tables (dependencies, issues) exist and are readable","If it's a wisp table, check that dberrors/missingOptionalWispTable classification matches your engine's error text (version alignment)","Retry on transient connectivity failures"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure required dependency tables exist before ready work\nfor _, t := range []string{\"dependencies\", \"issues\"} {\n\tvar c int\n\tif err := db.QueryRow(\"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = ?\", t).Scan(&c); err != nil || c == 0 {\n\t\treturn fmt.Errorf(\"missing required table %s\", t)\n\t}\n}","typeGuard":"func isDeferredEdgeError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"deferred parents: \") && strings.Contains(err.Error(), \"/\")\n}","tryCatchPattern":"ready, err := repo.GetReadyWork(ctx, filter)\nif isDeferredEdgeError(err) {\n\t// check the depTable/issueTable named in the message; migrate schema, then retry\n}\n","preventionTips":["Keep dependencies/issues tables present via migrations","Align engine and driver versions so missing-wisp-table errors are classified correctly","Watch for schema drift between environments","Retry only on transient connectivity errors"],"tags":["database","ready-work","deferred","join"],"backgroundTag":"deferred-parent-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}