FlowiseAI/Flowise · error · Error
User ID contains invalid characters. Allowed: letters, digit
Error message
User ID contains invalid characters. Allowed: letters, digits, . _ @ + -
What it means
Thrown when externalUserId (after trim) fails the SAFE_USER_ID regex /^[a-zA-Z0-9._@+-]{1,250}$/. This prevents characters outside the allowed set (and over-length values) from being passed to Pipedream as the external user identifier.
Source
Thrown at packages/components/nodes/tools/MCP/Pipedream/PipedreamMCP.ts:292
throw new Error(
'Variables in User ID are not resolved. ' +
'{{$vars.*}} requires a matching workspace variable. ' +
'{{$flow.*}} variables (e.g. sessionId) are only available at runtime, not when refreshing actions.'
)
}
// For loadMethods context, use a sanitized fallback so tool listing still works.
// The actual externalUserId will be resolved at runtime.
externalUserId = 'flowise_preview_user'
}
externalUserId = externalUserId.replace(/<[^>]*>/g, '').trim()
if (!externalUserId) {
throw new Error('Pipedream user ID is required')
}
const SAFE_USER_ID = /^[a-zA-Z0-9._@+-]{1,250}$/
if (!SAFE_USER_ID.test(externalUserId.trim())) {
throw new Error('User ID contains invalid characters. Allowed: letters, digits, . _ @ + -')
}
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const projectId = getCredentialParam('projectId', credentialData, nodeData)
const oauthScopes = getCredentialParam('oauthScopes', credentialData, nodeData) as string | 'connect:*'
if (!projectId) {
throw new Error('Pipedream Project ID is required in credentials')
}
const clientId = getCredentialParam('clientId', credentialData, nodeData)
const clientSecret = getCredentialParam('clientSecret', credentialData, nodeData)
if (!clientId || !clientSecret) {
throw new Error('Pipedream Client ID and Client Secret are required in credentials')
}
const accessToken = await this.fetchAccessToken(clientId, clientSecret, oauthScopes)
View on GitHub (pinned to abe4a8601a)
Solutions
- Use a plain identifier: letters, digits, dot, underscore, at, plus, hyphen only.
- Strip display names/angles from emails; use the bare address.
- If the source value is a UUID, that already passes; if it is a free-text username, sanitize it upstream.
- Keep the value under 250 characters.
Example fix
// before: externalUserId = 'Jane Doe <jane@example.com>' // after: externalUserId = 'jane@example.com'
Defensive patterns
Strategy: validation
Validate before calling
const SAFE_USER_ID = /^[a-zA-Z0-9._@+-]{1,250}$/
const uid = (externalUserId || '').trim()
if (!SAFE_USER_ID.test(uid)) {
throw new Error('User ID contains invalid characters')
} Type guard
function isSafeUserId(s: string): boolean {
return /^[a-zA-Z0-9._@+-]{1,250}$/.test(s.trim())
} Try / catch
try { await pipedream.getTools(nodeData, options) }
catch (e) { if (e instanceof Error && e.message.startsWith('User ID contains invalid characters')) { /* sanitize input */ } } Prevention
- Strip display-name formatting from emails before they reach the field.
- Validate length and charset in the UI with the same regex.
When it happens
Trigger: externalUserId contains spaces, colons, slashes, Unicode, emoji, angle brackets that survived stripping, or exceeds 250 characters.
Common situations: User entered an email with a display name 'Jane Doe <j@x.com>'; a UUID with hyphens is fine but a value with spaces is not; pasted a long JSON blob; Unicode username from an external IdP.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Invalid app slug format. Must be lowercase letters, digits,
- Security validation failed: ${error.message}
- Workspace context is required to load MCP server
- Pipedream app slug is required
- Variables in User ID are not resolved. {{$vars.*}} requires
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/1082e311eaaa28e8.
Report an issue: GitHub.