Troubleshooting
The messages you are most likely to meet, what they mean, and what to do.
Connecting
sw: cannot reach https://…
Nothing answered at the address. Check it with sw whoami: it should be your workspace's address, such
as https://acme.app.stateweave.net, with no path. A proxy or firewall between you and the workspace can
also cause it. If the address is right, the workspace may be restarting: try again in a minute.
sw worker keeps trying by itself.
did not accept that key / HTTP 401 invalid_api_key
The key was revoked, mistyped, or made in another workspace. Keys are per workspace. Make a new one under
Connect an agent and run sw login again. If STATEWEAVE_API_KEY is set in
your shell, it wins over what sw login kept: unset it or update it.
HTTP 429: too many requests with this key
Requests with one key are rate limited. The SDK waits and retries these by itself a few times; a script that still hits the limit is polling too fast.
Starting runs
HTTP 404: no test t-…
The id is wrong, or the test was deleted. sw task ls lists the tests your key can run.
t-… names a test in several projects: say which
Pass the scenario too: sw run t-… --env p-…, or project= in Python.
HTTP 409: t-… needs a re-check
Data was added to the scenario after the test was written, so its answer key may be out of date. Run
sw task recheck p-… and wait for it to finish. See Re-checking.
HTTP 429: 8 runs are going already
Your workspace runs a limited number of runs at once. Finish or cancel one first. Runs left without
finish() hold their place until they time out, so use the Python with block or give runs up
with sw cancel.
sw: could not start …
The command after -- doesn't exist or isn't executable. Nothing was started. Give the interpreter
explicitly: -- python my_agent.py, -- sh run.sh.
Grading
answer is not an object: None
Your agent handed in no answer for an answer test. With sw run it must write the answer to the file
STATEWEAVE_ANSWER_FILE names before it exits. Check the file is written to that exact path and holds
JSON in the shape of STATEWEAVE_ANSWER_FORMAT.
HTTP 409: the run has ended
The run timed out or was cancelled (on its page, or by Ctrl-C) before it was finished. In Python this is
stateweave.RunEnded, and e.run["status"] says how it ended. Raise the limit with
--timeout if your agent needs longer.
The run's status is error
The test's own check failed, not your agent: the run is not counted against it. Tell us at mikewei@stateweave.net with the run's link.
Your agent's calls
A Google client calls the real Google
Google's Python library ships its own copy of each API's discovery document. Pass the run's document and turn the
shipped one off: discoveryServiceUrl=…["endpoints"]["discovery"] and
static_discovery=False. See Gmail.
slack_sdk calls slack.com
Pass base_url=run.apps["slack"]["endpoints"]["web_api"] to WebClient. The trailing
/api/ is part of it.
ShopifyAPI calls a real Shopify store
Python's ShopifyAPI turns any shop name into <name>.myshopify.com. Set
shopify.Session.myshopify_domain to the run's domain first. See
Client libraries.
A Shopify call answers 404 with x-twin-not-implemented
That's the REST Admin API, which StateWeave doesn't serve. Use the GraphQL Admin API (admin_graphql)
instead.
Claude Code says a tool needs permission
In print mode, Claude Code refuses tools nobody approved. Pass --allowedTools "mcp__<app>__*"
for every app the test uses, or use the claude_code.sh script, which does it for you. See
Claude Code.
The calls show a fault I didn't expect
The test injects faults on purpose. Its page lists them, and the run's page shows each one that acted. See Faults.