{"record":{"id":"a299cd1ef0592811","repo":"t8y2/dbx","slug":"object-source-is-not-supported-a299cd","errorCode":null,"errorMessage":"Object source is not supported","messagePattern":"Object source is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"agents/common/src/main/java/com/dbx/agent/DatabaseAgent.java","lineNumber":79,"sourceCode":"        return result;\n    }\n\n    default List<ObjectInfo> listObjects(String schema, MetadataListConstraints constraints) {\n        return MetadataListConstraints.orNone(constraints).filterObjects(listObjects(schema));\n    }\n\n    default List<String> listDataTypes() {\n        return Collections.emptyList();\n    }\n\n    default CompletionAssistantResponse completionAssistantSearch(CompletionAssistantRequest request) {\n        throw new UnsupportedOperationException(\"Completion assistant search is not supported by this agent\");\n    }\n\n    List<ColumnInfo> getColumns(String schema, String table);\n\n    default ObjectSource getObjectSource(String schema, String name, String objectType) {\n        throw new UnsupportedOperationException(\"Object source is not supported\");\n    }\n\n    default String getTableDdl(String schema, String table) {\n        List<IndexInfo> indexes;\n        try {\n            indexes = listIndexes(schema, table);\n        } catch (RuntimeException e) {\n            indexes = Collections.emptyList();\n        }\n\n        List<ForeignKeyInfo> foreignKeys;\n        try {\n            foreignKeys = listForeignKeys(schema, table);\n        } catch (RuntimeException e) {\n            foreignKeys = Collections.emptyList();\n        }\n\n        String tableComment = null;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/common/src/main/java/com/dbx/agent/DatabaseAgent.java#L61-L97","documentation":"The default getObjectSource() on the DatabaseAgent interface throws UnsupportedOperationException because viewing object source code (procedure/view/function bodies) requires database-specific catalog queries. Only agents that implement source extraction override this method; on others the call fails immediately.","triggerScenarios":"Calling agent.getObjectSource(schema, name, objectType) on an implementation that does not override the default — e.g. requesting the source of a view/procedure on a database whose agent lacks source extraction.","commonSituations":"A database object explorer's 'View source' action is used against a database type that does not support source retrieval (or whose agent hasn't implemented it); the objectType passed is one the agent could never decompile anyway.","solutions":["Guard the call with a capability check (instanceof an interface or a supportsObjectSource() flag) and show 'source not available' in the UI.","Implement getObjectSource in the agent for the target database using its catalog (e.g. ALL_SOURCE, pg_get_functiondef, sp_helptext).","Fall back to DDL reconstruction via getTableDdl/DdlBuilder where source is unavailable."],"exampleFix":"// before\nString src = agent.getObjectSource(schema, name, objectType);\n// after\nString src = supportsObjectSource(agent)\n    ? agent.getObjectSource(schema, name, objectType)\n    : agent.getTableDdl(schema, name); // fallback or show 'not available'","handlingStrategy":"fallback","validationCode":"if (agent.getConnection() == null || !(agent instanceof SourceCapable)) { /* show 'source not available' */ }","typeGuard":"static boolean supportsObjectSource(DatabaseAgent a) {\n    return a instanceof SourceCapable;\n}","tryCatchPattern":"try {\n    return agent.getObjectSource(schema, name, objectType);\n} catch (UnsupportedOperationException e) {\n    return agent.getTableDdl(schema, name); // graceful degradation\n}","preventionTips":["Hide 'View source' UI actions for agents that do not implement getObjectSource.","Prefer getTableDdl as a documented fallback for tables.","Track supported capabilities per database type in a capability matrix."],"tags":["unsupported-operation","capability","metadata"],"backgroundTag":"feature-not-supported","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"}