{"record":{"id":"3c323b5501958b4e","repo":"ComposioHQ/composio","slug":"failed-to-parse-manage-connections-config","errorCode":null,"errorMessage":"Failed to parse manage connections config","messagePattern":"Failed to parse manage connections config","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/lib/toolRouterParams.ts","lineNumber":106,"sourceCode":"  params?: boolean | z.infer<typeof ToolRouterConfigManageConnectionsSchema>\n): SessionCreateParams.ManageConnections => {\n  if (params === undefined) {\n    // Default case when params is undefined\n    return {\n      enable: true,\n    };\n  }\n\n  if (typeof params === 'boolean') {\n    return {\n      enable: params,\n    };\n  }\n\n  // Parse the params using the zod schema for type safety\n  const parsedResult = ToolRouterConfigManageConnectionsSchema.safeParse(params);\n  if (!parsedResult.success) {\n    throw new ValidationError('Failed to parse manage connections config', {\n      cause: parsedResult.error,\n    });\n  }\n\n  const config = parsedResult.data;\n  return {\n    enable: config.enable ?? true,\n    callback_url: config.callbackUrl,\n    enable_wait_for_connections: config.waitForConnections,\n  };\n};\n\nexport const resolveToolRouterSandboxConfig = (\n  config: Pick<ToolRouterCreateSessionConfig, 'sandbox' | 'workbench'>\n): ToolRouterCreateSessionConfig['sandbox'] | ToolRouterCreateSessionConfig['workbench'] => {\n  if (config.sandbox !== undefined && config.workbench !== undefined) {\n    throw new ValidationError(\n      'Pass either sandbox or workbench, not both. workbench is a backwards-compatible alias for sandbox.'","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/lib/toolRouterParams.ts#L88-L124","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncreateSession({ manageConnections: { enabled: true } })\n// after\ncreateSession({ manageConnections: { enable: true } })","handlingStrategy":"validation","validationCode":"import { ToolRouterConfigManageConnectionsSchema } from '@composio/core/lib/toolRouterParams';\nconst ok = typeof mc === 'boolean' || ToolRouterConfigManageConnectionsSchema.safeParse(mc).success;","typeGuard":"const validManageConnections = (v: unknown): boolean =>\n  typeof v === 'boolean' || ToolRouterConfigManageConnectionsSchema.safeParse(v).success;","tryCatchPattern":"try { ... } catch (e) { if (e instanceof ValidationError && e.message.includes('manage connections')) fixShape(); }","preventionTips":["Use boolean shorthand when possible","Type configs with exported schema types"],"tags":["validation","zod","tool-router","sdk"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}