ComposioHQ/composio · error · ValidationError
Failed to parse connected account refresh options
Error message
Failed to parse connected account refresh options
What it means
ValidationError thrown when the options passed to ConnectedAccounts.refresh fail ConnectedAccountRefreshOptionsSchema. Typically an invalid or non-string redirectUrl.
Source
Thrown at ts/packages/core/src/models/ConnectedAccounts.ts:568
* @throws {Error} If the account doesn't exist or credentials cannot be refreshed
*
* @example
* ```typescript
* // Refresh a connected account's credentials
* const refreshedAccount = await composio.connectedAccounts.refresh('conn_abc123');
* ```
*/
async refresh(
nanoid: string,
options?: ConnectedAccountRefreshOptions,
requestOptions?: ComposioRequestOptions
): Promise<ConnectedAccountRefreshResponse> {
let params: ConnectedAccountRefreshParams | undefined = undefined;
if (options) {
const parsedOptions = ConnectedAccountRefreshOptionsSchema.safeParse(options);
if (!parsedOptions.success) {
throw new ValidationError('Failed to parse connected account refresh options', {
cause: parsedOptions.error,
});
}
params = {
query_redirect_url: parsedOptions.data.redirectUrl,
validate_credentials: parsedOptions.data.validateCredentials,
};
}
return withCancellation(
() => this.client.connectedAccounts.refresh(nanoid, params, requestOptions),
requestOptions?.signal
);
}
/**
* Update the status of a connected accountView on GitHub (pinned to 64b1b85502)
Solutions
- Check error.cause.issues for the offending field
- Ensure redirectUrl is a valid URL string (or omit it)
- Validate the value with new URL(redirectUrl) before calling
Example fix
// before
await c.connectedAccounts.refresh(id, { redirectUrl: process.env.REDIRECT });
// after
const redirect = process.env.REDIRECT;
await c.connectedAccounts.refresh(id, redirect ? { redirectUrl: redirect } : undefined); Defensive patterns
Strategy: validation
Validate before calling
if (options?.redirectUrl !== undefined) { try { new URL(options.redirectUrl); } catch { throw new Error('redirectUrl must be a valid URL'); } } Type guard
const isValidationError = (e: unknown): boolean => e instanceof ValidationError;
Try / catch
try { await ca.refresh(id, opts); } catch (e) { if (e instanceof ValidationError) { /* read e.cause.issues */ } } Prevention
- Type opts as ConnectedAccountRefreshOptions
- Validate URLs before passing
When it happens
Trigger: Calling composio.connectedAccounts.refresh(nanoid, { redirectUrl: <invalid> }) — wrong type, malformed URL, or unknown keys.
Common situations: Passing an env var that's undefined or not a URL; reusing raw query-string values without validation.
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
- Failed to parse connected account list query
- Failed to parse create connected account link options
- Failed to parse connected account ACL update params
- experimental_subAgent() schema must be a Zod schema or JSON
- Invalid arguments for local tool ${resolution.finalSlug}: ${
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/792e44cb5ef2960e.
Report an issue: GitHub.