{"record":{"id":"75cc9c48f0dbac92","repo":"gastownhall/beads","slug":"check-issue-existence-in-s-scan-w","errorCode":null,"errorMessage":"check issue existence in %s: scan: %w","messagePattern":"check issue existence in (.+?): scan: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/edges.go","lineNumber":164,"sourceCode":"\t\t\tplaceholders := make([]string, len(batch))\n\t\t\targs := make([]any, len(batch))\n\t\t\tfor i, id := range batch {\n\t\t\t\tplaceholders[i] = \"?\"\n\t\t\t\targs[i] = id\n\t\t\t}\n\t\t\trows, err := tx.QueryContext(ctx, fmt.Sprintf(\n\t\t\t\t\"SELECT id FROM %s WHERE id IN (%s)\", table, strings.Join(placeholders, \",\")), args...)\n\t\t\tif err != nil {\n\t\t\t\tif isTableNotExistError(err) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn nil, fmt.Errorf(\"check issue existence in %s: %w\", table, err)\n\t\t\t}\n\t\t\tfor rows.Next() {\n\t\t\t\tvar id string\n\t\t\t\tif scanErr := rows.Scan(&id); scanErr != nil {\n\t\t\t\t\t_ = rows.Close()\n\t\t\t\t\treturn nil, fmt.Errorf(\"check issue existence in %s: scan: %w\", table, scanErr)\n\t\t\t\t}\n\t\t\t\tpresent[id] = struct{}{}\n\t\t\t}\n\t\t\t_ = rows.Close()\n\t\t\tif err := rows.Err(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"check issue existence in %s: rows: %w\", table, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn present, nil\n}\n","sourceCodeStart":146,"sourceCodeEnd":176,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/edges.go#L146-L176","documentation":"PresentIssueOrWispIDsInTx failed while scanning a row of the existence probe (SELECT id FROM <table> WHERE id IN (...)) into a string. The scan error is wrapped with the table name and rows are closed before returning to avoid leaking the connection.","triggerScenarios":"The issues/wisps id column returning a value that cannot scan into string (NULL id from an unusual schema, wrong column type, or a customized query whose SELECT list no longer matches the single string scan).","commonSituations":"A schema variant where id is nullable; a non-Dolt driver with different type mappings; hand-edited code selecting additional columns while the scan still expects one.","solutions":["Read the wrapped scan error — it names the column and Go type mismatch.","Ensure the id column is NOT NULL VARCHAR in both issues and wisps.","Pin a supported driver version whose string mapping is stable.","If the query was customized, re-align the SELECT list with the single-string Scan."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := ExecuteEdgeRead(ctx, tx, req)\nif err != nil && strings.Contains(err.Error(), \"check issue existence in \") && strings.Contains(err.Error(), \": scan: \") {\n\tlog.Errorf(\"existence probe scan failure: %v\", err)\n}","preventionTips":["Keep id columns NOT NULL VARCHAR in issues and wisps","Pin a supported driver version","Do not alter the probe's SELECT list without updating the scan","Test existence probes against your real schema variant"],"tags":["database","sql","scan","type-mismatch"],"backgroundTag":"sql-scan-type-mismatch","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}