FlowiseAI/Flowise · error · Error
Failed to retrieve access token: Response missing access_tok
Error message
Failed to retrieve access token: Response missing access_token field
What it means
Thrown by PipedreamMCP.fetchAccessToken after the OAuth token exchange to https://api.pipedream.com/v1/oauth/token succeeds (HTTP 200) but the response body has no access_token field. The client-credentials grant returned a payload that is missing the expected token, so the code cannot proceed to cache or use a token.
Source
Thrown at packages/components/nodes/tools/MCP/Pipedream/PipedreamMCP.ts:220
try {
const body: Record<string, string> = {
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret
}
if (scope) {
body.scope = scope
}
const response = await axios.post('https://api.pipedream.com/v1/oauth/token', body, {
headers: {
'Content-Type': 'application/json'
}
})
const accessToken = response.data?.access_token
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}`)
}View on GitHub (pinned to abe4a8601a)
Solutions
- Log response.status and response.data to confirm what Pipedream actually returned.
- Check Pipedream status/changelog for a token-endpoint response format change.
- Ensure no proxy is rewriting the response body; call the endpoint directly to compare.
- If the body shape changed, update the access_token extraction path in fetchAccessToken accordingly.
Example fix
// before
const accessToken = response.data?.access_token
if (!accessToken) {
throw new Error('Failed to retrieve access token: Response missing access_token field')
}
// after (diagnostic, then fix extraction if shape changed)
console.error('Pipedream token response:', response.status, JSON.stringify(response.data))
const accessToken = response.data?.access_token || response.data?.token
if (!accessToken) {
throw new Error('Failed to retrieve access token: Response missing access_token field')
} Defensive patterns
Strategy: try-catch
Type guard
function hasAccessTokenField(data: unknown): boolean {
return typeof data === 'object' && data !== null
&& typeof (data as any).access_token === 'string'
&& (data as any).access_token.length > 0
} Try / catch
try {
const token = await pipedream.fetchAccessToken(clientId, clientSecret, scope)
} catch (e) {
if (e instanceof Error && e.message.startsWith('Failed to retrieve access token')) {
// log response shape, alert ops; this is an upstream contract issue, not a user fix
}
} Prevention
- Pin/monitor the Pipedream API contract; add an integration test that asserts access_token is present.
- Log response.status with response.data on failure to speed diagnosis.
- Treat this error as a candidate incident rather than a user-config problem.
When it happens
Trigger: A successful POST to Pipedream's /v1/oauth/token where response.data is null/undefined, an unexpected JSON shape, or response.data.access_token is empty string — for example an upstream API contract change, a proxy returning an HTML error page with 200, or a malformed response.
Common situations: Pipedream API changes its token response schema; an intermediary (corporate proxy, gateway) returns a 200 with a non-JSON body; axios transforms the response unexpectedly; the endpoint returns a partial object under load.
Related errors
- Pipedream OAuth token request failed [${code}]: ${message}
- Failed to fetch ${url} from Airtable: ${error.message}, stat
- Crawl failed: ${error.response.data.error}
- Pipedream Client ID and Client Secret are required in creden
- Connection to Pipedream MCP server timed out. Please check y
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/115b79066be8fc05.
Report an issue: GitHub.