{"record":{"id":"443a1776a6e9e8c1","repo":"gastownhall/beads","slug":"failed-to-get-molecule-w","errorCode":null,"errorMessage":"failed to get molecule: %w","messagePattern":"failed to get molecule: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_port.go","lineNumber":268,"sourceCode":"func (r uowMolReader) GetConfig(ctx context.Context, key string) (string, error) {\n\treturn r.uw.ConfigUseCase().GetConfig(ctx, key)\n}\n\nfunc (r uowMolReader) IsInfraTypeCtx(ctx context.Context, t types.IssueType) bool {\n\tok, err := r.uw.ConfigUseCase().IsInfraTypeCtx(ctx, t)\n\treturn err == nil && ok\n}\n\nfunc (r uowMolReader) GetCustomStatusesDetailed(ctx context.Context) ([]types.CustomStatus, error) {\n\treturn r.uw.ConfigUseCase().GetCustomStatuses(ctx)\n}\n\nfunc (r uowMolReader) GetMoleculeProgress(ctx context.Context, moleculeID string) (*types.MoleculeProgressStats, error) {\n\tstats := &types.MoleculeProgressStats{MoleculeID: moleculeID}\n\n\troot, err := r.GetIssue(ctx, moleculeID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get molecule: %w\", err)\n\t}\n\tif root != nil {\n\t\tstats.MoleculeTitle = root.Title\n\t}\n\n\tdependents, err := r.GetDependentsWithMetadata(ctx, moleculeID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get molecule children: %w\", err)\n\t}\n\n\tfor _, dependent := range dependents {\n\t\tif dependent.DependencyType != types.DepParentChild {\n\t\t\tcontinue\n\t\t}\n\t\tstats.Total++\n\t\tswitch dependent.Status {\n\t\tcase types.StatusClosed:\n\t\t\tstats.Completed++","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_port.go#L250-L286","documentation":"`GetMoleculeProgress` starts by fetching the molecule's root issue through `r.GetIssue`; if that call fails for any reason (not-found, storage error), it wraps the result as `failed to get molecule: %w`. The molecule root must be readable before progress statistics can be assembled.","triggerScenarios":"`runMolCurrentProxiedServer` or `runMolProgressProxiedServer` calls `GetMoleculeProgress(ctx, moleculeID)` with an ID that cannot be resolved — the underlying `GetIssue` error (1086/1087) is re-wrapped by this `fmt.Errorf(\"failed to get molecule: %w\", err)` line.","commonSituations":"Typo'd molecule ID on `bd mol progress <id>`; molecule root deleted after its children were burned; storage backend failing mid-command; pointing at a workspace that never had the molecule.","solutions":["Confirm the molecule root ID exists (`bd show <molecule-id>`) and correct it.","Unwrap the error to see whether it was not-found (fix the ID) or a storage failure (fix the database).","List molecules (`bd mol list` or query roots) to find the correct root ID."],"exampleFix":"// before\nbd mol progress bd-999   // nonexistent molecule\n// after\nbd mol progress bd-100   // verified molecule root","handlingStrategy":"validation","validationCode":"// verify the molecule root before asking for progress\nbd show \"$MOL_ID\" --json >/dev/null 2>&1 || { echo \"molecule $MOL_ID not found\"; exit 1; }\nbd mol progress \"$MOL_ID\"","typeGuard":"func moleculeReadable(ctx context.Context, r MolReader, id string) error {\n\t_, err := r.GetIssue(ctx, id)\n\treturn err\n}","tryCatchPattern":"stats, err := reader.GetMoleculeProgress(ctx, molID)\nif err != nil && strings.Contains(err.Error(), \"failed to get molecule\") {\n\treturn fmt.Errorf(\"molecule %q unreadable: %w\", molID, err)\n}","preventionTips":["Obtain molecule root IDs from listing commands, not memory.","Don't reuse root IDs after a molecule was burned or rebuilt.","Check database health when progress commands fail across many molecules."],"tags":["cli","not-found","molecule"],"backgroundTag":"issue-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}