Panniantong/Agent-Reach · error · SystemExit
[X] Could not find auth_token and ct0 in your input.
Error message
[X] Could not find auth_token and ct0 in your input.
What it means
For `agent-reach configure twitter-cookies`, the CLI parses the pasted value expecting either 'AUTH_TOKEN CT0' separated by whitespace or a Cookie-Editor Header String containing both auth_token and ct0 cookies. If neither token can be extracted, it prints this error with the accepted formats and exits 1.
Source
Thrown at agent_reach/cli.py:1515
" 凭据未实时验证:不会执行 `twitter status`,因为上游在"
"验证失败时会自动读取浏览器 Cookie。"
)
if not shutil.which("twitter"):
print(
" [!] twitter-cli 未安装。运行:pipx install twitter-cli"
)
else:
print(
" 注意:独立 `twitter` 命令不会读取 Agent Reach 配置;"
"直接使用时需显式设置 TWITTER_AUTH_TOKEN/TWITTER_CT0。"
)
else:
print("[X] Could not find auth_token and ct0 in your input.")
print(" Run `agent-reach configure twitter-cookies` and paste either:")
print(" 1. AUTH_TOKEN and CT0 separated by whitespace")
print(" 2. A Cookie-Editor Header String")
print(" For automation, pass the same value through --stdin.")
raise SystemExit(1)
elif args.key == "youtube-cookies":
config.set("youtube_cookies_from", value)
print(f"✅ YouTube cookie source configured: {value}")
print(" yt-dlp will use cookies from this browser for age-restricted/member videos.")
elif args.key == "xhs-cookies":
if not _configure_xhs_cookies(value):
raise SystemExit(1)
elif args.key == "github-token":
config.set("github_token", value)
print("✅ GitHub token configured!")
elif args.key == "groq-key":
config.set("groq_api_key", value)
print("✅ Groq key configured!")
View on GitHub (pinned to 93ae1d18c3)
Solutions
- In the Cookie-Editor extension on x.com, choose Export → 'Header String' (not JSON) and re-run: agent-reach configure twitter-cookies --stdin
- Or paste exactly two whitespace-separated values: <auth_token> <ct0>
- Confirm you are actually logged in to x.com in that browser (both cookies exist) before exporting
- For automation, generate the 'auth_token=...; ct0=...' header string programmatically and pipe it via --stdin
Example fix
# before: JSON export (unsupported) cat cookies.json | agent-reach configure twitter-cookies --stdin # after: header-string export (supported) # Cookie-Editor → Export → Header String, then: agent-reach configure twitter-cookies --stdin <<< 'auth_token=ABC123; ct0=XYZ789'
Defensive patterns
Strategy: validation
Validate before calling
import re
def looks_like_twitter_cookies(value: str) -> bool:
if re.search(r"auth_token=[^;\s]+", value) and re.search(r"\bct0=[^;\s]+", value):
return True # Cookie-Editor header string
parts = value.split()
return len(parts) == 2 and all(re.fullmatch(r"[A-Za-z0-9]{20,}", p) for p in parts)
assert looks_like_twitter_cookies(value), "need 'auth_token=..; ct0=..' header string or 'AUTH_TOKEN CT0' pair" Prevention
- Always export via Cookie-Editor → 'Header String'; JSON exports are not accepted
- Verify you are logged in on x.com before exporting (both auth_token and ct0 must exist)
- In automation, build the 'auth_token=...; ct0=...' string yourself and pipe it via --stdin
When it happens
Trigger: Pasting only one of the two tokens (auth_token without ct0), a Cookie-Editor export in JSON format instead of 'Header String' format, a header string from a different domain, or a value where the token names are misspelled. Automation hits it when piping a malformed string via --stdin.
Common situations: Users exporting cookies with the Cookie-Editor extension but clicking 'JSON' instead of 'Header String'; expired logged-out sessions where auth_token is absent; pasting from a note app that mangles separators; per CLAUDE.md, QR-scan logins for X are unsupported — only Cookie-Editor exports are.
Related errors
- No cookies found. Make sure you're logged into the platforms
- Could not read configure value from stdin
- Configure value exceeds the 1 MiB safety limit
- Configure input cancelled
- agent-reach configure: error: {scrub_url_credentials(exc)}
AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14).
Data as JSON: /api/errors/abace13cc1668cf4.
Report an issue: GitHub.