t8y2/dbx · error

type not found: %s.%s

Error message

type not found: %s.%s

What it means

xuguTypeDefinition resolves a user-defined type's definition (and later its attributes/methods) from metadata views. If the definition lookup finds no row for schema.typeName, it returns this error to completionAssistantSearchTypeMembers instead of an empty member list.

Source

Thrown at agents/drivers/xugu/type_members.go:252

		}
		var kind sql.NullInt64
		var spec sql.NullString
		if err := rows.Scan(&kind, &spec); err != nil {
			return xuguTypeDefinition{}, false, err
		}
		return xuguTypeDefinition{Kind: int(kind.Int64), Spec: spec.String}, true, nil
	}
	if definition, found, err := query(xuguObjectTypeSQL, schema, typeName); err != nil || found {
		return definition, err
	}
	definition, found, err := query(xuguObjectTypeCaseFoldedSQL, schema, typeName, schema, typeName)
	if err != nil {
		return xuguTypeDefinition{}, err
	}
	if found {
		return definition, nil
	}
	return xuguTypeDefinition{}, fmt.Errorf("type not found: %s.%s", schema, typeName)
}

// Some current XuguDB builds expose ALL_TYPES but do not publish the auxiliary
// ALL_TYPE_ATTRS / ALL_TYPE_METHODS views that older DBeaver integrations use.
// In that case the type specification is still authoritative and is the only
// low-privilege metadata source available. Parse only its top-level object
// declaration; this fallback never inspects or guesses from a TYPE BODY.
func parseXuguObjectTypeAttributes(spec string) []xuguTypeAttribute {
	attributes, _ := parseXuguObjectTypeMembers(spec)
	return attributes
}

func parseXuguObjectTypeMethods(spec string) []xuguTypeMethod {
	_, methods := parseXuguObjectTypeMembers(spec)
	return methods
}

func parseXuguObjectTypeMembers(spec string) ([]xuguTypeAttribute, []xuguTypeMethod) {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Confirm the type exists: query the type catalog for schema and exact type name.
  2. Qualify with the correct schema and match stored casing.
  3. Grant metadata read privileges to the connecting user.
  4. Reconnect to pick up newly created types if the session predates the type.

Example fix

// before
xuguTypeDefinition("sales", "order_typ") // actual name: ORDER_T
// after
xuguTypeDefinition("sales", "order_t")
Defensive patterns

Strategy: validation

Validate before calling

func typeExists(ctx context.Context, q Queryer, schema, typeName string) (bool, error) {
	var n int
	err := q.QueryRowContext(ctx,
		"SELECT COUNT(*) FROM all_types WHERE owner = ? AND type_name = ?",
		schema, typeName).Scan(&n)
	return n > 0, err
}

Try / catch

def, err := xuguTypeDefinition(schema, typeName)
if err != nil {
	if strings.HasPrefix(err.Error(), "type not found: ") {
		return nil, fmt.Errorf("type %s.%s not visible; check name, schema and grants", schema, typeName)
	}
	return nil, err
}

Prevention

When it happens

Trigger: Requesting type-member completion for schema.typeName where the ALL_TYPES-style lookup finds nothing: type name misspelled, wrong schema, type dropped, or the account cannot read the type's metadata row.

Common situations: SQL editor autocomplete on an OBJECT/ARRAY type with wrong casing or schema prefix, restricted metadata visibility for the current user, or referencing a type from an older XuguDB build where the view is unavailable.

Related errors


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