{"record":{"id":"590b186ed3c49858","repo":"t8y2/dbx","slug":"procedure-not-found-name","errorCode":null,"errorMessage":"Procedure not found: {name}","messagePattern":"Procedure not found: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/databend/src/main/java/com/dbx/agent/databend/DatabendAgent.java","lineNumber":88,"sourceCode":"        if (includeTables && !includeProcedures) {\n            return super.listObjects(schema, normalized);\n        }\n        if (!includeTables && !includeProcedures) {\n            return List.of();\n        }\n        return normalized.filterObjects(listObjects(schema));\n    }\n\n    @Override\n    public ObjectSource getObjectSource(String schema, String name, String objectType) {\n        if (!\"PROCEDURE\".equalsIgnoreCase(objectType)) {\n            return super.getObjectSource(schema, name, objectType);\n        }\n        return unchecked(() -> {\n            useSchema(schema);\n            ProcedureMetadata procedure = findProcedure(name);\n            if (procedure == null) {\n                throw new IllegalArgumentException(\"Procedure not found: \" + name);\n            }\n            Map<String, String> properties = describeProcedure(name, procedure.inputTypes);\n            String source = buildProcedureSource(name, procedure, properties);\n            return new ObjectSource(name, objectType, schema, source);\n        });\n    }\n\n    private void useSchema(String schema) throws SQLException {\n        if (schema == null || schema.trim().isEmpty()) {\n            return;\n        }\n        try (java.sql.Statement stmt = requireConnected().createStatement()) {\n            stmt.execute(DATABEND_PROFILE.schemaSwitchSql(schema.trim()));\n        }\n    }\n\n    private List<ObjectInfo> listProcedures(String schema, MetadataListConstraints constraints) {\n        return unchecked(() -> {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/databend/src/main/java/com/dbx/agent/databend/DatabendAgent.java#L70-L106","documentation":"DatabendAgent.getObjectSource located no procedure matching the given name in the target schema, so it throws IllegalArgumentException before attempting to describe or build the source. The library treats a missing procedure as a caller error rather than returning an empty ObjectSource.","triggerScenarios":"Calling getObjectSource(schema, name, objectType) for a procedure-type object where findProcedure(name) returns null after searching Databend's procedure metadata (e.g. SHOW PROCEDURES / information_schema).","commonSituations":"Procedure name typo or wrong case (Databend identifiers may be case-sensitive depending on quoting); procedure created in a different schema; procedure dropped or never created; connected to a database that doesn't contain the schema.","solutions":["Verify the procedure exists in the schema: run SHOW PROCEDURES IN <schema> or query information_schema for the procedure name.","Match the identifier casing exactly as created (quote with backticks if it contains mixed case).","Confirm the schema passed to useSchema is the schema where the procedure was created.","Check you are connected to the correct Databend tenant/database."],"exampleFix":"// before\nagent.getObjectSource(conn, \"analytics\", \"daily_rollup\", \"PROCEDURE\");\n// after\n// verify first: SHOW PROCEDURES IN analytics LIKE 'daily_rollup';\nagent.getObjectSource(conn, \"analytics\", \"daily_rollup\", \"PROCEDURE\");","handlingStrategy":"validation","validationCode":"// Java (caller side)\ntry (var stmt = conn.createStatement();\n     var rs = stmt.executeQuery(\"SHOW PROCEDURES IN `\" + schema + \"`\")) {\n    boolean found = false;\n    while (rs.next()) {\n        if (name.equals(rs.getString(\"name\"))) { found = true; break; }\n    }\n    if (!found) throw new IllegalArgumentException(\"Procedure missing in schema: \" + schema + \".\" + name);\n}\nObjectSource src = agent.getObjectSource(conn, schema, name, \"PROCEDURE\");","typeGuard":null,"tryCatchPattern":"try {\n    src = agent.getObjectSource(conn, schema, name, \"PROCEDURE\");\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Procedure not found\")) {\n        LOG.warn(\"Databend procedure {}.{} not found; skipping\", schema, name);\n    } else { throw e; }\n}","preventionTips":["Confirm procedure existence (SHOW PROCEDURES / information_schema) before requesting its source.","Match identifier casing exactly as created; use backticks for mixed-case names.","Keep a record of procedures deployed per schema and validate names against it.","Fail fast in CI by listing expected procedures and diffing against the live database."],"tags":["metadata","databend","procedure-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-14T00:17:10.932Z"}