{"record":{"id":"249d324c2f5d352e","repo":"t8y2/dbx","slug":"object-not-found-s-s","errorCode":null,"errorMessage":"object not found: %s.%s","messagePattern":"object not found: (.+?)\\.(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/oracle-go/main.go","lineNumber":3360,"sourceCode":"FROM (\n  SELECT OBJECT_TYPE\n  FROM ALL_OBJECTS\n  WHERE OWNER = :1\n    AND OBJECT_NAME = :2\n    AND OBJECT_TYPE IN ('TABLE', 'VIEW', 'MATERIALIZED VIEW')\n  ORDER BY CASE OBJECT_TYPE WHEN 'TABLE' THEN 0 WHEN 'VIEW' THEN 1 ELSE 2 END\n)\nWHERE ROWNUM = 1`, schema, objectName).Scan(&objectType)\n\t}\n\terr = resolve(exact)\n\tif errors.Is(err, sql.ErrNoRows) && hasUppercaseFallback {\n\t\terr = resolve(uppercase)\n\t\tif err == nil {\n\t\t\texact = uppercase\n\t\t}\n\t}\n\tif errors.Is(err, sql.ErrNoRows) {\n\t\treturn \"\", \"\", fmt.Errorf(\"object not found: %s.%s\", schema, name)\n\t}\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn normalizeDDLObjectType(objectType), exact, nil\n}\n\nfunc normalizeDDLObjectType(value string) string {\n\tswitch strings.ToUpper(strings.ReplaceAll(strings.TrimSpace(value), \" \", \"_\")) {\n\tcase \"TABLE\":\n\t\treturn \"TABLE\"\n\tcase \"VIEW\":\n\t\treturn \"VIEW\"\n\tcase \"MATERIALIZED_VIEW\":\n\t\treturn \"MATERIALIZED_VIEW\"\n\tdefault:\n\t\treturn \"\"\n\t}","sourceCodeStart":3342,"sourceCodeEnd":3378,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/oracle-go/main.go#L3342-L3378","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the object exists: SELECT owner, object_name FROM all_objects WHERE object_name = UPPER('name')","Qualify with the correct schema/owner and confirm the connected user has SELECT privileges on it","Check the object type — a synonym or different type may need a different lookup path","If the name was created with mixed case quotes, pass the exact quoted identifier"],"exampleFix":"// before\nBuildViewDDL(\"HR\", \"emp_view\") // ORA: object not found: HR.EMP_VIEW\n// after\nSELECT view_name FROM all_views WHERE owner='HR'; -- find exact name, then\nBuildViewDDL(\"HR\", \"EMPLOYEES_VW\")","handlingStrategy":"validation","validationCode":"var n int\nerr := db.QueryRow(`SELECT COUNT(*) FROM all_objects WHERE owner = :1 AND object_name = :2`,\n    strings.ToUpper(schema), strings.ToUpper(name)).Scan(&n)\nif err != nil || n == 0 { return fmt.Errorf(\"precheck: %s.%s not visible to current user\", schema, name) }","typeGuard":null,"tryCatchPattern":"typ, exact, err := resolveObject(db, schema, name)\nif err != nil && strings.Contains(err.Error(), \"object not found\") {\n    return fmt.Errorf(\"%s.%s not visible to user %s; check owner, name, and grants\", schema, name, currentUser)\n}","preventionTips":["Always qualify objects with their owner/schema","Verify grants (SELECT on the object or dictionary visibility) before metadata calls","Use exact, uppercase names unless the identifier was created quoted","Check all_objects/ALL_DEPENDENCIES when unsure of the object type"],"tags":["go","oracle","metadata","object-not-found"],"backgroundTag":"object-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"}