{"record":{"id":"ddce668e8b9c133d","repo":"Panniantong/Agent-Reach","slug":"missing-value-for-args-key","errorCode":null,"errorMessage":"Missing value for {args.key}","messagePattern":"Missing value for (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"agent_reach/cli.py","lineNumber":1451,"sourceCode":"        else:\n            print(f\"No cookies found. Make sure you're logged into the platforms in {browser}.\")\n            raise SystemExit(1)\n        return\n\n    # ── Manual configure ──\n    if not args.key:\n        print(\"Usage: agent-reach configure <key> [--stdin]\")\n        print(\"   Omit the value to enter it through a hidden prompt.\")\n        print(\n            \"   or: agent-reach configure --from-browser chrome \"\n            \"--platform xueqiu\"\n        )\n        return\n\n    value = _read_configure_value(args)\n    if not value:\n        print(f\"Missing value for {args.key}\")\n        raise SystemExit(1)\n\n    if args.key == \"proxy\":\n        # Generic network proxy for restricted environments. Nothing reads\n        # this key at runtime — agents read it back and export HTTP(S)_PROXY\n        # before invoking upstream tools (see docs/install.md). The legacy\n        # bilibili_proxy key is kept in sync for older configs.\n        config.set(\"proxy\", value)\n        config.set(\"bilibili_proxy\", value)\n        print(\"✅ 代理已保存（供 Agent 在访问 Reddit/Twitter 等需要代理的网络时设置 HTTP_PROXY/HTTPS_PROXY）\")\n        print(\"  Note: B站走 bili-cli，国内网络无需代理。\")\n\n    elif args.key == \"twitter-cookies\":\n        # Accept two formats:\n        # 1. auth_token ct0 (two separate values)\n        # 2. Full cookie header string: \"auth_token=xxx; ct0=yyy; ...\"\n        auth_token, ct0 = _parse_twitter_cookie_input(value)\n\n        if auth_token and ct0:","sourceCodeStart":1433,"sourceCodeEnd":1469,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/cli.py#L1433-L1469","documentation":"In manual configure mode, after `agent-reach configure <key>` reads a value (positional, --stdin, or hidden prompt), an empty result (empty string, whitespace-only stdin, or immediate Enter at the prompt) prints 'Missing value for <key>' and exits 1. Config is not modified.","triggerScenarios":"Running `agent-reach configure proxy` and just pressing Enter at the hidden prompt; piping an empty file via --stdin (e.g. `: | agent-reach configure key --stdin`); `agent-reach configure key \"\"` with an empty quoted argument.","commonSituations":"Automation where the secret-producing step failed and emitted nothing, so the pipe delivers an empty stream; users pressing Enter to 'skip' a prompt; trailing-newline-only files passed via --stdin after rstrip.","solutions":["Re-run and actually provide the value; for --stdin ensure the source file/pipe is non-empty","Check the producer in your pipeline: test -s value.txt && agent-reach configure key --stdin < value.txt","If you meant to clear a key, note empty values are rejected — remove the key from ~/.agent-reach/config.yaml or use a placeholder per platform docs"],"exampleFix":"# before: silently proceeds even when the producer wrote nothing\n./fetch-token.sh > token.txt\nagent-reach configure github-token --stdin < token.txt\n\n# after: fail fast on an empty value file\n./fetch-token.sh > token.txt\ntest -s token.txt || { echo 'token fetch failed' >&2; exit 1; }\nagent-reach configure github-token --stdin < token.txt","handlingStrategy":"validation","validationCode":"import os\n\ndef has_configure_value(source: str) -> bool:\n    if source == \"stdin\":\n        return not sys.stdin.isatty() and sys.stdin.read().strip() != \"\"\n    return len(source.strip()) > 0\n\n# shell variant: test -s value.txt || echo 'empty value' >&2","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `test -s file` before redirecting files into --stdin","Check the exit code of token-producing scripts before piping their output to configure","Empty input is always rejected; there is deliberately no 'clear key by empty value' path"],"tags":["cli","configure","validation","missing-value","exit-code-1"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}