{"record":{"id":"a385dcc15255f003","repo":"t8y2/dbx","slug":"custom-type-s-s-does-not-exist-a385dc","errorCode":null,"errorMessage":"custom type %s.%s does not exist","messagePattern":"custom type (.+?)\\.(.+?) does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/vastbase-go/vastbase_metadata.go","lineNumber":620,"sourceCode":"\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}\n\tif typelem != 0 {\n\t\treturn nil, fmt.Errorf(\"custom type %s.%s is an array companion type\", schema, name)","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/vastbase-go/vastbase_metadata.go#L602-L638","documentation":"getTypeDetails() in the Vastbase/PostgreSQL metadata driver queried sys_catalog/pg_catalog for a custom type and the query returned zero rows, meaning no type with that schema-qualified name exists in the database. The library treats a missing catalog row as a hard error because it cannot describe a type that is not in the catalog. It is raised only after the query itself succeeded (rows.Err() was nil), so it is a genuine 'not found', not an I/O failure.","triggerScenarios":"Calling getTypeDetails (or the driver API that surfaces type metadata) with a schema.name that does not match any row in pg_type/sys_catalog.typ; a typo in the type or schema name; querying an unquoted mixed-case name that was created quoted; querying the wrong database or the wrong server connection; the type was dropped by a concurrent migration before the lookup.","commonSituations":"Migration scripts dropped or renamed the type between planning and execution; connecting to a different environment (staging vs prod) where the type was never created; search_path confusion causing the caller to pass the wrong schema; spelling the type without the schema it actually lives in; running against a Vastbase instance in MySQL compatibility mode or an older version lacking the type.","solutions":["Verify the type exists with an explicit catalog query: SELECT n.nspname, t.typname FROM pg_type t JOIN pg_namespace n ON n.oid=t.typnamespace WHERE t.typname='<name>';","Correct the schema and type name strings passed to getTypeDetails, matching exact case and quoting as created","Confirm you are connected to the intended database/host and that the type was created (check migration logs)","If the type may legitimately be absent, check existence first (or catch this error) instead of treating it as fatal"],"exampleFix":"// before\ndetails, err := srv.getTypeDetails(\"public\", \"MyStatus\") // \"MyStatus\" was created as \"mystatus\"\n// after\ndetails, err := srv.getTypeDetails(\"public\", \"mystatus\")","handlingStrategy":"validation","validationCode":"func typeExists(ctx context.Context, q Queryer, schema, name string) (bool, error) {\n    var n int\n    err := q.QueryRowContext(ctx,\n        \"SELECT count(*) FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON n.oid=t.typnamespace WHERE n.nspname=$1 AND t.typname=$2\",\n        schema, name).Scan(&n)\n    return n > 0, err\n}","typeGuard":null,"tryCatchPattern":"details, err := srv.getTypeDetails(schema, name)\nif err != nil {\n    if strings.Contains(err.Error(), \"does not exist\") {\n        return nil, nil\n    }\n    return nil, err\n}","preventionTips":["Check existence before lookup; handle absence as a normal case","Pin down the exact schema and case of the type name"],"tags":["postgres","metadata","type-not-found","catalog"],"backgroundTag":"type-not-found","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"}