t8y2/dbx · error
view source not found: %s.%s
Error message
view source not found: %s.%s
What it means
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.
Source
Thrown at agents/drivers/oracle-go/main.go:3426
var source string
fallbackErr := db.QueryRow(
"SELECT TEXT FROM ALL_VIEWS WHERE OWNER = :1 AND VIEW_NAME = :2",
schema, viewName,
).Scan(&source)
if fallbackErr == nil && strings.TrimSpace(source) != "" {
return strings.TrimSpace(source), nil
}
if fallbackErr != nil && !errors.Is(fallbackErr, sql.ErrNoRows) {
if metadataErr != nil {
return "", fmt.Errorf(
"failed to load view source for %s.%s: DBMS_METADATA: %v; ALL_VIEWS: %w",
schema, viewName, metadataErr, fallbackErr,
)
}
return "", fmt.Errorf("failed to load view source for %s.%s from ALL_VIEWS: %w", schema, viewName, fallbackErr)
}
return "", fmt.Errorf("view source not found: %s.%s", schema, viewName)
}
func (s *server) buildTableDDL(schema, table string) (string, error) {
columns, err := s.getColumns(schema, table)
if err != nil {
return "", err
}
if len(columns) == 0 {
return "", fmt.Errorf("table not found: %s.%s", schema, table)
}
var builder strings.Builder
builder.WriteString("CREATE TABLE ")
builder.WriteString(quoteIdentifier(schema))
builder.WriteByte('.')
builder.WriteString(quoteIdentifier(table))
builder.WriteString(" (\n")
for i, column := range columns {
if i > 0 {View on GitHub (pinned to c0390bff16)
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
Example fix
// before
BuildViewDDL("SALES", "old_view") // dropped earlier
// after
SELECT view_name FROM all_views WHERE owner='SALES';
BuildViewDDL("SALES", "CURRENT_VIEW") Defensive patterns
Strategy: validation
Validate before calling
var exists bool
db.QueryRow(`SELECT COUNT(*) FROM all_views WHERE owner=:1 AND view_name=:2`,
strings.ToUpper(schema), strings.ToUpper(view)).Scan(&exists)
if !exists { return fmt.Errorf("view %s.%s does not exist or is not visible", schema, view) } Try / catch
src, err := loadViewSource(s, schema, view)
if err != nil && strings.Contains(err.Error(), "view source not found") {
return fmt.Errorf("%s.%s has no retrievable source; verify it is a real, accessible view", schema, view)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to load view source for %s.%s: DBMS_METADATA: %v; ALL
- failed to load view source for %s.%s from ALL_VIEWS: %w
- agent session not found: %s
- agent session not found: %s
- reserve connection for manual transaction: %w
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/c6ff961e26966a3c.
Report an issue: GitHub.