{"record":{"id":"bd993bc091ec759b","repo":"gastownhall/beads","slug":"iter-dep-metadata-w","errorCode":null,"errorMessage":"iter dep metadata: %w","messagePattern":"iter dep metadata: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/dependency.go","lineNumber":542,"sourceCode":"\t\tUseWispsTable: useWisp,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list dep metadata: %w\", err)\n\t}\n\treturn out, nil\n}\n\nfunc (u *dependencyUseCaseImpl) iterWithMetadata(ctx context.Context, sourceID string, filter DepListFilter, useWisp bool) (storage.Iter[types.IssueWithDependencyMetadata], error) {\n\tif sourceID == \"\" {\n\t\treturn nil, fmt.Errorf(\"iter dep metadata: sourceID must not be empty\")\n\t}\n\tit, err := u.depRepo.IterWithIssueMetadata(ctx, sourceID, DepListOpts{\n\t\tTypes:         filter.Types,\n\t\tDirection:     filter.Direction,\n\t\tUseWispsTable: useWisp,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"iter dep metadata: %w\", err)\n\t}\n\treturn it, nil\n}\n\nfunc (u *dependencyUseCaseImpl) countByID(ctx context.Context, sourceID string, filter DepListFilter, useWisp bool) (int64, error) {\n\tif sourceID == \"\" {\n\t\treturn 0, fmt.Errorf(\"count by id: sourceID must not be empty\")\n\t}\n\tn, err := u.depRepo.CountByID(ctx, sourceID, DepListOpts{\n\t\tTypes:         filter.Types,\n\t\tDirection:     filter.Direction,\n\t\tUseWispsTable: useWisp,\n\t})\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"count by id: %w\", err)\n\t}\n\treturn n, nil\n}","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/dependency.go#L524-L560","documentation":"Wraps a repository failure from depRepo.IterWithIssueMetadata after the empty-ID guard passes. Opening the streaming iterator over dependency metadata failed at the storage layer.","triggerScenarios":"Calling IterWithIssueMetadata or IterWispWithIssueMetadata with a valid sourceID where IterWithIssueMetadata on depRepo returns an error.","commonSituations":"DB connection pool exhausted; query timeout on large graphs; schema drift after upgrade; wisp-table variant against a deployment lacking the table.","solutions":["Check the wrapped cause to distinguish connection vs query errors","Retry; iterator creation is read-only and safe to repeat","Verify migrations and wisps table presence for the wisp variant","Bound the context deadline appropriately for large result sets"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if sourceID == \"\" {\n\treturn fmt.Errorf(\"sourceID required\")\n}","typeGuard":null,"tryCatchPattern":"it, err := u.IterWithIssueMetadata(ctx, sourceID, filter)\nif err != nil {\n\t// read-only: safe to retry after transient DB errors\n\tif isTransient(errors.Unwrap(err)) {\n\t\ttime.Sleep(backoff); it, err = u.IterWithIssueMetadata(ctx, sourceID, filter)\n\t}\n}","preventionTips":["Retry transient causes; iterator creation is side-effect free","Verify wisp table exists for the wisp variant","Watch connection pool exhaustion under concurrent iteration","Keep schema migrations current"],"tags":["storage","dependency","iterator","wrapped-error"],"backgroundTag":"dependency-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}