googleapis/mcp-toolbox · error

invalid queryExecMode %q: must be one of %q, %q, %q, %q, or

Error message

invalid queryExecMode %q: must be one of %q, %q, %q, %q, or %q

What it means

ParseQueryExecMode fell through its switch on the configured queryExecMode string; the value is not one of the five accepted pgx execution modes (empty, cache_statement, cache_describe, describe_exec, exec, simple_protocol).

Source

Thrown at internal/sources/postgres/postgres.go:219

		u.RawQuery = q.Encode()
	}
	return u.String()
}

func ParseQueryExecMode(queryExecMode string) (pgx.QueryExecMode, error) {
	switch queryExecMode {
	case "", "cache_statement":
		return pgx.QueryExecModeCacheStatement, nil
	case "cache_describe":
		return pgx.QueryExecModeCacheDescribe, nil
	case "describe_exec":
		return pgx.QueryExecModeDescribeExec, nil
	case "exec":
		return pgx.QueryExecModeExec, nil
	case "simple_protocol":
		return pgx.QueryExecModeSimpleProtocol, nil
	default:
		return 0, fmt.Errorf("invalid queryExecMode %q: must be one of %q, %q, %q, %q, or %q", queryExecMode, "cache_statement", "cache_describe", "describe_exec", "exec", "simple_protocol")
	}
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set queryExecMode to one of: cache_statement, cache_describe, describe_exec, exec, or simple_protocol
  2. Omit queryExecMode entirely to accept the default (cache_statement)
  3. Check for typos or trailing whitespace in the YAML value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/sources/postgres/postgres.go:219 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/a6608114e3ec48db. Report an issue: GitHub.