{"record":{"id":"a45d6820ad3f4e7b","repo":"FlowiseAI/Flowise","slug":"pipedream-oauth-token-request-failed-code","errorCode":null,"errorMessage":"Pipedream OAuth token request failed [${code}]: ${message}","messagePattern":"Pipedream OAuth token request failed \\[(.+?)\\]: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MCP/Pipedream/PipedreamMCP.ts","lineNumber":237,"sourceCode":"            if (!accessToken) {\n                throw new Error('Failed to retrieve access token: Response missing access_token field')\n            }\n\n            const expiresIn = response.data?.expires_in ?? 3600\n            tokenCache.set(tokenCacheKey, {\n                token: accessToken,\n                expiresAt: Date.now() + expiresIn * 1000\n            })\n\n            return accessToken\n        } catch (error: any) {\n            if (error.response?.status === 401) {\n                tokenCache.delete(tokenCacheKey)\n                throw new Error('Invalid Pipedream credentials. Please verify your Client ID and Client Secret.')\n            }\n            const message = error.message ?? 'Unknown error'\n            const code = error.code ?? error.response?.status ?? 'UNKNOWN'\n            throw new Error(`Pipedream OAuth token request failed [${code}]: ${message}`)\n        }\n    }\n\n    private async resolveVarsInString(value: string, nodeData: INodeData, options: ICommonObject): Promise<string> {\n        if (!value.includes('{{$vars.')) return value\n\n        const workspaceId = options?.searchOptions?.workspaceId?._value || options?.workspaceId\n        if (!workspaceId) return value\n\n        const appDataSource = options.appDataSource as DataSource\n        const databaseEntities = options.databaseEntities as IDatabaseEntity\n        const optionsWithWorkspaceId = options.workspaceId ? options : { ...options, workspaceId }\n        const variables = await getVars(appDataSource, databaseEntities, nodeData, optionsWithWorkspaceId)\n        const vars = prepareSandboxVars(variables) as Record<string, string>\n\n        return value.replace(VAR_PLACEHOLDER_RE, (match, varName) => {\n            return vars[varName] != null ? String(vars[varName]) : match\n        })","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MCP/Pipedream/PipedreamMCP.ts#L219-L255","documentation":"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.","triggerScenarios":"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.","commonSituations":"No outbound internet access / firewall blocking api.pipedream.com; transient Pipedream outage (5xx); misconfigured corporate proxy; DNS resolution failure; scope parameter rejected by Pipedream.","solutions":["Read the [code] and message in the thrown error: network codes (ENOTFOUND/ETIMEDOUT) point to connectivity, HTTP status codes point to Pipedream.","Test connectivity to https://api.pipedream.com/v1/oauth/token from the server.","If code is a 4xx, verify the request body fields (grant_type, scope) match Pipedream's current spec.","Retry after confirming network and Pipedream status."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    const token = await pipedream.fetchAccessToken(clientId, clientSecret, scope)\n} catch (e) {\n    const m = e instanceof Error ? e.message : ''\n    if (m.startsWith('Pipedream OAuth token request failed')) {\n        // parse [code]: network codes -> connectivity; HTTP 4xx/5xx -> Pipedream side\n    }\n}","preventionTips":["Ensure outbound HTTPS to api.pipedream.com is allowed and stable.","Retry with backoff for transient codes (ETIMEDOUT, 5xx).","Surface the parsed code in monitoring to classify incidents quickly."],"tags":["pipedream","oauth","network","error-handling","diagnostics"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}