{"record":{"id":"06f2fcfcec19b9ef","repo":"t8y2/dbx","slug":"routine-source-is-not-supported-for-s-connections","errorCode":null,"errorMessage":"routine source is not supported for %s connections","messagePattern":"routine source is not supported for (.+?) connections","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/metadata.go","lineNumber":733,"sourceCode":"\tfor _, row := range result.Rows {\n\t\tif line := firstRowValue(row); line != \"\" {\n\t\t\tlines = append(lines, line)\n\t\t}\n\t}\n\tif len(lines) == 0 {\n\t\treturn \"\", nil\n\t}\n\treturn strings.Join(lines, \"\\n\") + \"\\n\", nil\n}\n\nfunc (server *server) getObjectSource(database, schema, name, objectType string) (objectSource, error) {\n\tschema = firstNonEmpty(schema, database, server.config.Database)\n\tvar source string\n\tvar err error\n\tswitch strings.ToUpper(objectType) {\n\tcase \"PROCEDURE\", \"FUNCTION\":\n\t\tif !server.supportsRoutines() {\n\t\t\treturn objectSource{}, fmt.Errorf(\"routine source is not supported for %s connections\", server.params.DatabaseType)\n\t\t}\n\t\tsource, err = server.getRoutineSource(database, schema, name, strings.ToUpper(objectType))\n\tdefault:\n\t\tsource, err = server.getTableDDL(schema, name)\n\t}\n\tif err != nil {\n\t\treturn objectSource{}, err\n\t}\n\treturn objectSource{\n\t\tName:       name,\n\t\tObjectType: strings.ToUpper(objectType),\n\t\tSchema:     optionalString(schema),\n\t\tSource:     source,\n\t}, nil\n}\n\n// getRoutineSource fetches a procedure or function's full source from the\n// server's system.procedures_v / system.functions_v view. Returns an empty","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/metadata.go#L715-L751","documentation":"Returned by getObjectSource when the caller asks for the DDL/source of a PROCEDURE or FUNCTION on a connection whose database backend does not support stored routines (server.supportsRoutines() is false for the configured DatabaseType). The library routes object-source lookups either to routine source extraction or to table DDL; routine extraction is only available on drivers that implement it, so unsupported backends fail fast with this message instead of returning garbage. It is a configuration/capability mismatch, not a transient failure.","triggerScenarios":"Calling the object-source API (metadata.go, the function containing the switch on objectType) with objectType 'PROCEDURE' or 'FUNCTION' while server.params.DatabaseType names a backend where supportsRoutines() returns false (e.g. MySQL-protocol proxies or other connections without routine DDL support).","commonSituations":"Pointing the tooling at a database type that stores logic elsewhere (e.g. no stored procedures defined or supported); assuming all connections expose routine DDL like SQL Server does; a config file where databaseType was changed but old routine-introspection jobs still run.","solutions":["Check server.params.DatabaseType; only request PROCEDURE/FUNCTION source on backends that support routines","Change the connection's databaseType to one whose supportsRoutines() returns true if routines are genuinely needed","For unsupported backends, request TABLE objects (routed to getTableDDL) instead of routines","Guard the call site: call supportsRoutines() (or replicate the DatabaseType check) before requesting routine source"],"exampleFix":"// before\nsrc, err := getObjectSource(ctx, \"PROCEDURE\", \"my_proc\")\n// after\nif !server.supportsRoutines() {\n    return nil, fmt.Errorf(\"routines unsupported for %s; introspect tables instead\", server.params.DatabaseType)\n}\nsrc, err := getObjectSource(ctx, \"PROCEDURE\", \"my_proc\")","handlingStrategy":"validation","validationCode":"if strings.EqualFold(objectType, \"PROCEDURE\") || strings.EqualFold(objectType, \"FUNCTION\") {\n    if !server.supportsRoutines() {\n        return nil, fmt.Errorf(\"routine introspection unavailable for databaseType %q\", server.params.DatabaseType)\n    }\n}","typeGuard":"func routinesSupported(params struct{ DatabaseType string }) bool {\n    switch strings.ToUpper(params.DatabaseType) {\n    case \"POSTGRES\", \"SQLSERVER\", \"ORACLE\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Check supportsRoutines()/databaseType before requesting routine source","Restrict routine-introspection jobs to databases that implement them","Centralize capability flags per backend instead of probing at call time"],"tags":["database","metadata","unsupported-feature"],"backgroundTag":"unsupported-database-feature","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"}