#8380 Cannot convert argument to ByteString (non-ASCII in CLOUDFLARE_ACCOUNT_ID)
User set CLOUDFLARE_ACCOUNT_ID to Russian placeholder text. ByteString error is cryptic - should validate account ID format and provide clear error message about invalid/non-ASCII characters.
Add account ID format validation before API calls with helpful error message
Analysis Report
Issue #8380: Cannot convert argument to a ByteString (non-ASCII in CLOUDFLARE_ACCOUNT_ID)
Summary
- Title: Cannot convert argument to a ByteString because the character at index 7 has a value of 1074 which is greater than 255
- State: OPEN
- Created: 2025-03-06
- Updated: 2025-10-30
- Labels: bug, error-messaging
- Reporter Version: Wrangler 3.113.0, Node v22.12.0, Windows 11
Issue Description
The user set CLOUDFLARE_ACCOUNT_ID to a Russian placeholder string (ваш-идентификатор-аккаунта, meaning "your-account-identifier") instead of an actual account ID. When running wrangler pages project list, they received a cryptic ByteString error instead of a helpful error message about invalid account ID.
The error occurs in the API fetch layer when the non-ASCII characters in the account ID are passed to HTTP headers, which only support ASCII characters (0-255).
Root Cause Analysis
The error originates from Node.js/undici's HTTP implementation which rejects non-ASCII characters in headers. The account ID is used in the API URL path and potentially headers, and no validation occurs before the API call.
From the logs:
GET https://api.cloudflare.com/client/v4/accounts/ваш-идентификатор-аккаунта/pages/projects?per_page=10&page=1
Related Issues
- #10717: vite-plugin cannot run in a non-ASCII directory - CLOSED
- Fixed by PR #10774 (merged 2025-09-29)
- This fixed non-ASCII in file paths for vite-plugin specifically
- Different issue: directory paths vs. account ID validation
Search for Fixes
- No PRs reference issue #8380
- No changelog entries mention this issue
- The ByteString error in PR search results (#9454, #6949) are unrelated
- No account ID validation improvements found in changelog
Version Gap Analysis
- Reporter version: 3.113.0 (2025-03-06)
- Current version: 4.60.0
- Gap: Major version change (3.x to 4.x), ~10 months
Recommendation: KEEP OPEN
Difficulty: easy
Reasoning
- Valid bug: The error message is unhelpful and doesn't indicate the actual problem (invalid/non-ASCII account ID)
- User experience issue: The commenter correctly notes that wrangler should sanitize user input and provide clear instructions
- No fix implemented: No PRs or changelog entries address this specific issue
- Easy fix: Add validation for account ID format before making API calls, providing a clear error like "Account ID contains invalid characters. Account IDs should only contain alphanumeric characters and hyphens."
- Labels appropriate: Has
error-messaginglabel which correctly categorizes it as an error message improvement
Suggested Fix Location
- Validate account ID format in
packages/wrangler/src/cfetch/internal.tsor in the account ID resolution code before making API calls - Check for non-ASCII characters (characters > 127) and provide a helpful error message
Suggested Comment
This issue is still valid. The error message should be improved to detect non-ASCII characters in the account ID and provide a clear, actionable error message like:
"Invalid account ID: Account IDs should only contain alphanumeric characters and hyphens. The provided value contains non-ASCII characters."
This is a relatively straightforward fix that would improve the user experience, especially for users who may have copied placeholder text from documentation or AI-generated examples.
Notes & Feedback (0)
No notes yet.