t8y2/dbx · error

object not found: %s.%s

Error message

object not found: %s.%s

What it means

The driver resolves an object's type by looking it up (resolve) across case variants; when the lookup returns sql.ErrNoRows for every variant, it converts that into a friendlier 'object not found: schema.name' error. It means no row for that object exists in the catalog view queried (e.g. ALL_TABLES/ALL_VIEWS).

Source

Thrown at agents/drivers/oracle-go/main.go:3360

FROM (
  SELECT OBJECT_TYPE
  FROM ALL_OBJECTS
  WHERE OWNER = :1
    AND OBJECT_NAME = :2
    AND OBJECT_TYPE IN ('TABLE', 'VIEW', 'MATERIALIZED VIEW')
  ORDER BY CASE OBJECT_TYPE WHEN 'TABLE' THEN 0 WHEN 'VIEW' THEN 1 ELSE 2 END
)
WHERE ROWNUM = 1`, schema, objectName).Scan(&objectType)
	}
	err = resolve(exact)
	if errors.Is(err, sql.ErrNoRows) && hasUppercaseFallback {
		err = resolve(uppercase)
		if err == nil {
			exact = uppercase
		}
	}
	if errors.Is(err, sql.ErrNoRows) {
		return "", "", fmt.Errorf("object not found: %s.%s", schema, name)
	}
	if err != nil {
		return "", "", err
	}
	return normalizeDDLObjectType(objectType), exact, nil
}

func normalizeDDLObjectType(value string) string {
	switch strings.ToUpper(strings.ReplaceAll(strings.TrimSpace(value), " ", "_")) {
	case "TABLE":
		return "TABLE"
	case "VIEW":
		return "VIEW"
	case "MATERIALIZED_VIEW":
		return "MATERIALIZED_VIEW"
	default:
		return ""
	}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify the object exists: SELECT owner, object_name FROM all_objects WHERE object_name = UPPER('name')
  2. Qualify with the correct schema/owner and confirm the connected user has SELECT privileges on it
  3. Check the object type — a synonym or different type may need a different lookup path
  4. If the name was created with mixed case quotes, pass the exact quoted identifier

Example fix

// before
BuildViewDDL("HR", "emp_view") // ORA: object not found: HR.EMP_VIEW
// after
SELECT view_name FROM all_views WHERE owner='HR'; -- find exact name, then
BuildViewDDL("HR", "EMPLOYEES_VW")
Defensive patterns

Strategy: validation

Validate before calling

var n int
err := db.QueryRow(`SELECT COUNT(*) FROM all_objects WHERE owner = :1 AND object_name = :2`,
    strings.ToUpper(schema), strings.ToUpper(name)).Scan(&n)
if err != nil || n == 0 { return fmt.Errorf("precheck: %s.%s not visible to current user", schema, name) }

Try / catch

typ, exact, err := resolveObject(db, schema, name)
if err != nil && strings.Contains(err.Error(), "object not found") {
    return fmt.Errorf("%s.%s not visible to user %s; check owner, name, and grants", schema, name, currentUser)
}

Prevention

When it happens

Trigger: Requesting DDL/metadata for a schema.name combination that does not exist, is in a different schema, or is a different object type than queried; also when the user lacks SELECT privileges so the object is invisible in ALL_* views.

Common situations: Typo in table/view name; connecting as a user without visibility into the target schema; object was dropped/renamed; case-sensitivity confusion for mixed-case identifiers created with quotes.

Related errors


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