t8y2/dbx · error

routine source is not supported for %s connections

Error message

routine source is not supported for %s connections

What it means

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.

Source

Thrown at agents/drivers/argo-go/metadata.go:733

	for _, row := range result.Rows {
		if line := firstRowValue(row); line != "" {
			lines = append(lines, line)
		}
	}
	if len(lines) == 0 {
		return "", nil
	}
	return strings.Join(lines, "\n") + "\n", nil
}

func (server *server) getObjectSource(database, schema, name, objectType string) (objectSource, error) {
	schema = firstNonEmpty(schema, database, server.config.Database)
	var source string
	var err error
	switch strings.ToUpper(objectType) {
	case "PROCEDURE", "FUNCTION":
		if !server.supportsRoutines() {
			return objectSource{}, fmt.Errorf("routine source is not supported for %s connections", server.params.DatabaseType)
		}
		source, err = server.getRoutineSource(database, schema, name, strings.ToUpper(objectType))
	default:
		source, err = server.getTableDDL(schema, name)
	}
	if err != nil {
		return objectSource{}, err
	}
	return objectSource{
		Name:       name,
		ObjectType: strings.ToUpper(objectType),
		Schema:     optionalString(schema),
		Source:     source,
	}, nil
}

// getRoutineSource fetches a procedure or function's full source from the
// server's system.procedures_v / system.functions_v view. Returns an empty

View on GitHub (pinned to c0390bff16)

Solutions

  1. Check server.params.DatabaseType; only request PROCEDURE/FUNCTION source on backends that support routines
  2. Change the connection's databaseType to one whose supportsRoutines() returns true if routines are genuinely needed
  3. For unsupported backends, request TABLE objects (routed to getTableDDL) instead of routines
  4. Guard the call site: call supportsRoutines() (or replicate the DatabaseType check) before requesting routine source

Example fix

// before
src, err := getObjectSource(ctx, "PROCEDURE", "my_proc")
// after
if !server.supportsRoutines() {
    return nil, fmt.Errorf("routines unsupported for %s; introspect tables instead", server.params.DatabaseType)
}
src, err := getObjectSource(ctx, "PROCEDURE", "my_proc")
Defensive patterns

Strategy: validation

Validate before calling

if strings.EqualFold(objectType, "PROCEDURE") || strings.EqualFold(objectType, "FUNCTION") {
    if !server.supportsRoutines() {
        return nil, fmt.Errorf("routine introspection unavailable for databaseType %q", server.params.DatabaseType)
    }
}

Type guard

func routinesSupported(params struct{ DatabaseType string }) bool {
    switch strings.ToUpper(params.DatabaseType) {
    case "POSTGRES", "SQLSERVER", "ORACLE":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/06f2fcfcec19b9ef. Report an issue: GitHub.