t8y2/dbx · error

failed to locate custom type %s.%s: %w

Error message

failed to locate custom type %s.%s: %w

What it means

Returned by server.getTypeDetails in kingbase-go when the initial catalog query locating the custom type (queries.general) fails at the database level — connection trouble, permission denial, or catalog SQL rejection. The wrapped error carries the driver-level cause; no type row was read.

Source

Thrown at agents/drivers/kingbase-go/kingbase_metadata.go:683

	}
	schema = strings.TrimSpace(schema)
	name = strings.TrimSpace(name)
	if schema == "" || name == "" {
		return nil, errors.New("schema and type name are required")
	}
	if isSystemSchema(schema) {
		return nil, fmt.Errorf("system schema %s is not supported for custom type details", schema)
	}
	catalog := "sys_catalog"
	if s.mode.postgresCatalog {
		catalog = "pg_catalog"
	}
	prefix := catalogPrefix(catalog)
	queries := customTypeCatalogQueriesFor(catalog, prefix, schema, name)

	rows, err := s.metadataQuery(queries.general)
	if err != nil {
		return nil, fmt.Errorf("failed to locate custom type %s.%s: %w", schema, name, err)
	}
	defer rows.Close()
	if !rows.Next() {
		if err := rows.Err(); err != nil {
			return nil, fmt.Errorf("failed to read type %s.%s: %w", schema, name, err)
		}
		return nil, fmt.Errorf("custom type %s.%s does not exist", schema, name)
	}
	var oid, typbasetype, typrelid, typelem, typcollation int64
	var typtype, typalign, typstorage string
	var typisdefined, typnotnull, typbyval bool
	var typdefaultbin, typdefault, inputFn, outputFn, receiveFn, sendFn, analyzeFn, comment, collname, relkind sql.NullString
	var typlen sql.NullInt64
	var typtypmod int64
	if 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 {
		return nil, fmt.Errorf("failed to read type %s.%s: %w", schema, name, err)
	}
	if err := rows.Close(); err != nil {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Read the wrapped error for the SQL/driver cause
  2. Verify the metadata connection is alive and the role can read sys_catalog/pg_catalog
  3. Retry if the failure was a transient connection drop
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agents/drivers/kingbase-go/kingbase_metadata.go:683 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/9bedd1f80763fba0. Report an issue: GitHub.