{"record":{"id":"c6ff961e26966a3c","repo":"t8y2/dbx","slug":"view-source-not-found-s-s","errorCode":null,"errorMessage":"view source not found: %s.%s","messagePattern":"view source not found: (.+?)\\.(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/oracle-go/main.go","lineNumber":3426,"sourceCode":"\n\tvar source string\n\tfallbackErr := db.QueryRow(\n\t\t\"SELECT TEXT FROM ALL_VIEWS WHERE OWNER = :1 AND VIEW_NAME = :2\",\n\t\tschema, viewName,\n\t).Scan(&source)\n\tif fallbackErr == nil && strings.TrimSpace(source) != \"\" {\n\t\treturn strings.TrimSpace(source), nil\n\t}\n\tif fallbackErr != nil && !errors.Is(fallbackErr, sql.ErrNoRows) {\n\t\tif metadataErr != nil {\n\t\t\treturn \"\", fmt.Errorf(\n\t\t\t\t\"failed to load view source for %s.%s: DBMS_METADATA: %v; ALL_VIEWS: %w\",\n\t\t\t\tschema, viewName, metadataErr, fallbackErr,\n\t\t\t)\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"failed to load view source for %s.%s from ALL_VIEWS: %w\", schema, viewName, fallbackErr)\n\t}\n\treturn \"\", fmt.Errorf(\"view source not found: %s.%s\", schema, viewName)\n}\n\nfunc (s *server) buildTableDDL(schema, table string) (string, error) {\n\tcolumns, err := s.getColumns(schema, table)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(columns) == 0 {\n\t\treturn \"\", fmt.Errorf(\"table not found: %s.%s\", schema, table)\n\t}\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"CREATE TABLE \")\n\tbuilder.WriteString(quoteIdentifier(schema))\n\tbuilder.WriteByte('.')\n\tbuilder.WriteString(quoteIdentifier(table))\n\tbuilder.WriteString(\" (\\n\")\n\tfor i, column := range columns {\n\t\tif i > 0 {","sourceCodeStart":3408,"sourceCodeEnd":3444,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/oracle-go/main.go#L3408-L3444","documentation":"If DBMS_METADATA returned no source and the ALL_VIEWS fallback found no row (sql.ErrNoRows) or empty text, the driver concludes the view has no retrievable source and returns 'view source not found: schema.viewName'. Unlike errors 887/888 there is no underlying DB error — the object simply yielded no source.","triggerScenarios":"Requesting DDL for a view that does not exist (so ALL_VIEWS has no row and DBMS_METADATA returned nothing), or a view whose TEXT is empty/null and DBMS_METADATA is unavailable to the user.","commonSituations":"Stale client cache referencing a dropped view; wrong schema qualification; account without dictionary privileges making DBMS_METADATA silently unavailable while ALL_VIEWS has no matching row; materialized views queried as regular views.","solutions":["Confirm the view exists: SELECT owner, view_name FROM all_views WHERE view_name = UPPER('name')","Use the correct schema/owner qualification, including exact case for quoted identifiers","Grant DBMS_METADATA access so the primary extraction path can succeed","Check the object is a view (not a materialized view or synonym) and use the matching DDL builder"],"exampleFix":"// before\nBuildViewDDL(\"SALES\", \"old_view\") // dropped earlier\n// after\nSELECT view_name FROM all_views WHERE owner='SALES';\nBuildViewDDL(\"SALES\", \"CURRENT_VIEW\")","handlingStrategy":"validation","validationCode":"var exists bool\ndb.QueryRow(`SELECT COUNT(*) FROM all_views WHERE owner=:1 AND view_name=:2`,\n    strings.ToUpper(schema), strings.ToUpper(view)).Scan(&exists)\nif !exists { return fmt.Errorf(\"view %s.%s does not exist or is not visible\", schema, view) }","typeGuard":null,"tryCatchPattern":"src, err := loadViewSource(s, schema, view)\nif err != nil && strings.Contains(err.Error(), \"view source not found\") {\n    return fmt.Errorf(\"%s.%s has no retrievable source; verify it is a real, accessible view\", schema, view)\n}","preventionTips":["Validate the view exists in all_views before requesting its DDL","Refresh any cached view lists after deployments/migrations","Grant DBMS_METADATA access — an empty source usually means the fallback alone was used","Distinguish views from materialized views/synonyms and use the right builder"],"tags":["go","oracle","view","not-found"],"backgroundTag":"view-source-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}