{"record":{"id":"65b641060dd23012","repo":"jaegertracing/jaeger","slug":"failed-to-scan-dependency-row-w","errorCode":null,"errorMessage":"failed to scan dependency row: %w","messagePattern":"failed to scan dependency row: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/clickhouse/depstore/reader.go","lineNumber":47,"sourceCode":"type dependencyKey struct {\n\tparent string\n\tchild  string\n}\n\nfunc (r *Reader) GetDependencies(ctx context.Context, query depstore.QueryParameters) ([]model.DependencyLink, error) {\n\trows, err := r.conn.Query(ctx, sql.SelectDependencies, query.StartTime, query.EndTime)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to query dependencies: %w\", err)\n\t}\n\tdefer rows.Close()\n\n\t// Merge dependencies from all snapshots in the time range.\n\tmerged := make(map[dependencyKey]uint64)\n\n\tfor rows.Next() {\n\t\tvar blob string\n\t\tif err := rows.Scan(&blob); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to scan dependency row: %w\", err)\n\t\t}\n\t\tvar links []dependencyLink\n\t\tif err := json.Unmarshal([]byte(blob), &links); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to unmarshal dependencies JSON: %w\", err)\n\t\t}\n\t\tfor _, link := range links {\n\t\t\tmerged[dependencyKey{link.Parent, link.Child}] += link.CallCount\n\t\t}\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read dependency rows: %w\", err)\n\t}\n\n\tif len(merged) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tdependencies := make([]model.DependencyLink, 0, len(merged))","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/clickhouse/depstore/reader.go#L29-L65","documentation":"While iterating result rows in GetDependencies, each row holds a JSON blob of dependency links that is scanned into a string. If rows.Scan fails — a NULL, an unexpected column type, or driver-level decode error — the error is wrapped with this message and returned, aborting dependency retrieval. It indicates the stored data or schema deviates from what the reader expects, not a transient fault.","triggerScenarios":"GetDependencies iterating rows where rows.Scan(&blob) fails: the dependencies column is NULL or of an unexpected type (e.g. non-String due to a schema change), or the driver fails to decode the value into a string.","commonSituations":"Schema drift after upgrading Jaeger or running an older ClickHouse schema against newer code; manual table edits leaving NULL blobs; corrupted snapshot rows from an interrupted write; wrong database/table pointed at by config.","solutions":["Verify the ClickHouse schema matches the expected jaeger_dependencies layout (dependencies column is a non-nullable String).","Re-run schema initialization/migration and inspect offending rows; repair or delete corrupted snapshots.","Unwrap with errors.As to the clickhouse-go error type to confirm the scan/decode cause before changing data."],"exampleFix":"// schema before\ndependencies Nullable(String)\n// after\ndependencies String CODEC(ZSTD(1))","handlingStrategy":"try-catch","validationCode":"// check schema expectations before querying\nrows, err := conn.Query(ctx, \"SELECT name, type FROM system.columns WHERE table = 'jaeger_dependencies'\")\n// verify a non-nullable String dependencies column exists","typeGuard":null,"tryCatchPattern":"deps, err := reader.GetDependencies(ctx, q)\nif err != nil {\n  if strings.Contains(err.Error(), \"failed to scan dependency row\") {\n    log.Printf(\"schema or data corruption suspected: %v\", err) // trigger schema repair/verification\n  }\n  return err\n}","preventionTips":["Pin and run the schema migration matching your Jaeger version","Keep the dependencies column non-nullable String; alert on schema drift via system.columns checks","Treat scan errors as data/schema problems, not transient — do not blind-retry"],"tags":["clickhouse","dependency-store","row-scan","schema"],"backgroundTag":"database-row-scan-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}