ComposioHQ/composio · error · ValidationError
Failed to parse manage connections config
Error message
Failed to parse manage connections config
What it means
ValidationError thrown when the params object passed to transformToolRouterManageConnectionsParams fails the ToolRouterConfigManageConnectionsSchema Zod parse. Note booleans are short-circuited to { enable: params } before the schema, so this fires only on malformed non-boolean objects (wrong field names, invalid credential fields).
Source
Thrown at ts/packages/core/src/lib/toolRouterParams.ts:106
params?: boolean | z.infer<typeof ToolRouterConfigManageConnectionsSchema>
): SessionCreateParams.ManageConnections => {
if (params === undefined) {
// Default case when params is undefined
return {
enable: true,
};
}
if (typeof params === 'boolean') {
return {
enable: params,
};
}
// Parse the params using the zod schema for type safety
const parsedResult = ToolRouterConfigManageConnectionsSchema.safeParse(params);
if (!parsedResult.success) {
throw new ValidationError('Failed to parse manage connections config', {
cause: parsedResult.error,
});
}
const config = parsedResult.data;
return {
enable: config.enable ?? true,
callback_url: config.callbackUrl,
enable_wait_for_connections: config.waitForConnections,
};
};
export const resolveToolRouterSandboxConfig = (
config: Pick<ToolRouterCreateSessionConfig, 'sandbox' | 'workbench'>
): ToolRouterCreateSessionConfig['sandbox'] | ToolRouterCreateSessionConfig['workbench'] => {
if (config.sandbox !== undefined && config.workbench !== undefined) {
throw new ValidationError(
'Pass either sandbox or workbench, not both. workbench is a backwards-compatible alias for sandbox.'View on GitHub (pinned to 64b1b85502)
Solutions
- Check the cause (ZodError) for exact failing paths
- Match the expected shape: boolean, or { enable: boolean, credentials?: [...] }
- Update to current docs/types for ToolRouterConfigManageConnectionsSchema
- Let TypeScript types guide construction instead of raw object literals
Example fix
// before
createSession({ manageConnections: { enabled: true } })
// after
createSession({ manageConnections: { enable: true } }) Defensive patterns
Strategy: validation
Validate before calling
import { ToolRouterConfigManageConnectionsSchema } from '@composio/core/lib/toolRouterParams';
const ok = typeof mc === 'boolean' || ToolRouterConfigManageConnectionsSchema.safeParse(mc).success; Type guard
const validManageConnections = (v: unknown): boolean => typeof v === 'boolean' || ToolRouterConfigManageConnectionsSchema.safeParse(v).success;
Try / catch
try { ... } catch (e) { if (e instanceof ValidationError && e.message.includes('manage connections')) fixShape(); } Prevention
- Use boolean shorthand when possible
- Type configs with exported schema types
When it happens
Trigger: Passing manageConnections as an object with unknown keys, wrong casing (enableConnections instead of enable), or malformed credentials arrays instead of a boolean or the expected { enable, credentials? } shape.
Common situations: Schema drift after upgrading the SDK when field names changed; hand-constructed config objects copied from old docs; passing the whole session config instead of the manageConnections sub-object.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Pass either sandbox or workbench, not both. workbench is a b
- Failed to parse auth config create options
- Failed to parse auth config update data
- Failed to parse connected account list query
- experimental_subAgent() schema must be a Zod schema or JSON
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/3c323b5501958b4e.
Report an issue: GitHub.