{"record":{"id":"dec94cdaf6c5c164","repo":"t8y2/dbx","slug":"failed-to-read-type-s-s-w-dec94c","errorCode":null,"errorMessage":"failed to read type %s.%s: %w","messagePattern":"failed to read type (.+?)\\.(.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/vastbase-go/vastbase_metadata.go","lineNumber":618,"sourceCode":"\t}\n\tif isSystemSchema(schema) {\n\t\treturn nil, fmt.Errorf(\"system schema %s is not supported for custom type details\", schema)\n\t}\n\tcatalog := \"sys_catalog\"\n\tif s.mode.postgresCatalog {\n\t\tcatalog = \"pg_catalog\"\n\t}\n\tprefix := catalogPrefix(catalog)\n\tqueries := customTypeCatalogQueriesFor(catalog, prefix, schema, name)\n\n\trows, err := s.metadataQuery(queries.general)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to locate custom type %s.%s: %w\", schema, name, err)\n\t}\n\tdefer rows.Close()\n\tif !rows.Next() {\n\t\tif err := rows.Err(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read type %s.%s: %w\", schema, name, err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s does not exist\", schema, name)\n\t}\n\tvar oid, typbasetype, typrelid, typelem, typcollation int64\n\tvar typtype, typalign, typstorage string\n\tvar typisdefined, typnotnull, typbyval bool\n\tvar typdefaultbin, typdefault, inputFn, outputFn, receiveFn, sendFn, analyzeFn, comment, collname, relkind sql.NullString\n\tvar typlen sql.NullInt64\n\tvar typtypmod int64\n\tif err := rows.Scan(&oid, &typtype, &typisdefined, &typbasetype, &typnotnull, &typrelid, &typelem, &typcollation, &typdefaultbin, &typdefault, &typlen, &typbyval, &typalign, &typstorage, &typtypmod, &inputFn, &outputFn, &receiveFn, &sendFn, &analyzeFn, &comment, &relkind, &collname); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read type %s.%s: %w\", schema, name, err)\n\t}\n\tif err := rows.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\tif !typisdefined {\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s is not fully defined\", schema, name)\n\t}","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/vastbase-go/vastbase_metadata.go#L600-L636","documentation":"After locating the type's catalog row, this error wraps failures that occur while advancing or scanning the result set (vastbase_metadata.go:617-618 and 628-629). It means the row was found but its contents could not be read — either the driver hit an I/O/protocol error iterating rows (rows.Err()) or the row's column values could not be scanned into the expected Go types (int64/string/bool/NullString).","triggerScenarios":"rows.Err() returns non-nil during iteration (connection lost mid-result, server error streamed after the row), or rows.Scan fails because a catalog column has an unexpected type or NULL where a typed value was expected (e.g. NULL in typalign on a nonstandard server, driver type-mapping differences).","commonSituations":"Network interruption while the result set streams; running against a server version whose pg_type/sys_type columns differ (NULLs or different types); driver-level scanning quirks for Vastbase-specific column types.","solutions":["Inspect the wrapped error (%w): if it is a connection/IO error, reconnect and retry the call.","If it is a Scan type error, check the server version's catalog column types and update the driver (or its scan targets) to match.","Test the same catalog query manually in psql/vsql to see whether a column returns NULL or an unexpected value.","Upgrade the vastbase-go driver to a version that handles your server's catalog layout (mode detection via postgresCatalog may need to be correct)."],"exampleFix":"// before\nvar typalign string\nrows.Scan(..., &typalign, ...) // fails: NULL in typalign\n// after\nvar typalign sql.NullString\nrows.Scan(..., &typalign, ...)\nalign := typalign.String","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"details, err := s.getTypeDetails(schema, name)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to read type \") {\n        var root error = err\n        for errors.Unwrap(root) != nil { root = errors.Unwrap(root) }\n        if isTransient(root) { // connection dropped mid-result: retry once\n            return s.getTypeDetails(schema, name)\n        }\n        return nil, fmt.Errorf(\"catalog row for %s.%s unreadable (server version/driver mismatch?): %w\", schema, name, root)\n    }\n    return nil, err\n}","preventionTips":["Use a stable network path / connection pool settings so result sets are not truncated by idle disconnects.","Match driver version to server version; catalog column layout changes between releases cause Scan failures.","If you customize catalog queries, mirror any nullable columns with sql.Null* scan targets.","Test metadata reads against your exact Vastbase version in CI to catch scanning mismatches early."],"tags":["database","metadata","scan-error","result-set"],"backgroundTag":"row-scan-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}