FlowiseAI/Flowise · error · Error

Pipedream OAuth token request failed [${code}]: ${message}

Error message

Pipedream OAuth token request failed [${code}]: ${message}

What it means

The generic catch-all thrown by fetchAccessToken when the token request fails for any reason other than a 401. It surfaces the underlying axios error.code (e.g. ENOTFOUND, ETIMEDOUT) or response status, plus the error message, so the failure mode is identifiable.

Source

Thrown at packages/components/nodes/tools/MCP/Pipedream/PipedreamMCP.ts:237

            if (!accessToken) {
                throw new Error('Failed to retrieve access token: Response missing access_token field')
            }

            const expiresIn = response.data?.expires_in ?? 3600
            tokenCache.set(tokenCacheKey, {
                token: accessToken,
                expiresAt: Date.now() + expiresIn * 1000
            })

            return accessToken
        } catch (error: any) {
            if (error.response?.status === 401) {
                tokenCache.delete(tokenCacheKey)
                throw new Error('Invalid Pipedream credentials. Please verify your Client ID and Client Secret.')
            }
            const message = error.message ?? 'Unknown error'
            const code = error.code ?? error.response?.status ?? 'UNKNOWN'
            throw new Error(`Pipedream OAuth token request failed [${code}]: ${message}`)
        }
    }

    private async resolveVarsInString(value: string, nodeData: INodeData, options: ICommonObject): Promise<string> {
        if (!value.includes('{{$vars.')) return value

        const workspaceId = options?.searchOptions?.workspaceId?._value || options?.workspaceId
        if (!workspaceId) return value

        const appDataSource = options.appDataSource as DataSource
        const databaseEntities = options.databaseEntities as IDatabaseEntity
        const optionsWithWorkspaceId = options.workspaceId ? options : { ...options, workspaceId }
        const variables = await getVars(appDataSource, databaseEntities, nodeData, optionsWithWorkspaceId)
        const vars = prepareSandboxVars(variables) as Record<string, string>

        return value.replace(VAR_PLACEHOLDER_RE, (match, varName) => {
            return vars[varName] != null ? String(vars[varName]) : match
        })

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Read the [code] and message in the thrown error: network codes (ENOTFOUND/ETIMEDOUT) point to connectivity, HTTP status codes point to Pipedream.
  2. Test connectivity to https://api.pipedream.com/v1/oauth/token from the server.
  3. If code is a 4xx, verify the request body fields (grant_type, scope) match Pipedream's current spec.
  4. Retry after confirming network and Pipedream status.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    const token = await pipedream.fetchAccessToken(clientId, clientSecret, scope)
} catch (e) {
    const m = e instanceof Error ? e.message : ''
    if (m.startsWith('Pipedream OAuth token request failed')) {
        // parse [code]: network codes -> connectivity; HTTP 4xx/5xx -> Pipedream side
    }
}

Prevention

When it happens

Trigger: Token request fails with a network error (DNS failure, timeout), a 5xx from Pipedream, an invalid request body, or an unexpected exception inside the try block that is not the 401 branch.

Common situations: No outbound internet access / firewall blocking api.pipedream.com; transient Pipedream outage (5xx); misconfigured corporate proxy; DNS resolution failure; scope parameter rejected by Pipedream.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/a45d6820ad3f4e7b. Report an issue: GitHub.