English · 简体中文
Every failure under --json writes one line to stderr:
cws:json {"ok":false,"error":{"code":"…","status":403,"reason":"…","message":"…","hint":"…"}}
Branch on error.code — it is stable, and adding a code is a compatible change.
status and reason are Google’s own; message is for humans; hint is the
fix we would try next.
Extract the envelope and read a code:
cws release --json 2>err.log || sed -n 's/^cws:json //p' err.log | jq -r .error.code
code |
Meaning | Usual fix |
|---|---|---|
NO_CREDENTIALS |
No key or token configured | Set CWS_SERVICE_ACCOUNT_FILE or CWS_ACCESS_TOKEN |
CREDENTIALS_UNREADABLE |
Key file missing, or not valid JSON | Paste the whole key file; a private_key through a shell or CI variable usually loses its newlines |
AUTH_FAILED |
Google rejected the credentials (HTTP 401) | Access tokens last about an hour; re-run the token exchange. Twice in a row means the key is wrong |
PUBLISHER_FORBIDDEN |
Account not authorized for this item (HTTP 403) | Add the service-account email in the Developer Dashboard under Settings → Management; check publisherId. A disabled Chrome Web Store API also surfaces as this 403 |
ITEM_NOT_FOUND |
Wrong itemId/publisherId, or no such item (HTTP 404) |
Fix .cws.json; the item must exist in the store |
ITEM_STATE_CONFLICT |
The item’s state blocks this request (HTTP 409 / FAILED_PRECONDITION) |
Run cws status and act on the state it prints |
RATE_LIMITED |
The store throttled the call (HTTP 429) | Back off, then retry once |
API_ERROR |
Unclassified store error | Read status and reason in the envelope |
UPLOAD_REJECTED |
The store rejected the package (upload FAILED) |
Raise the manifest version above the published one; check the manifest and package size |
UPLOAD_TIMEOUT |
The asynchronous upload did not settle in time | Raise --timeout, or check the dashboard |
MISCONFIGURED |
.cws.json is invalid or incomplete |
Fill in publisherId and itemId |
INVALID_PACKAGE |
Zip missing, ambiguous, or not a zip | Build the package first, or pass an exact path |
USAGE |
The command line could not be parsed | Fix the arguments; exit code is 2 |
INTERNAL |
An unexpected failure | Re-run with CWS_DEBUG=1 for a stack trace |
Coarse, for shells: 0 success, 1 failure, 2 usage error. The detail lives
in error.code.
NO_CREDENTIALS, CREDENTIALS_UNREADABLE, MISCONFIGURED,
INVALID_PACKAGE, USAGE, ITEM_NOT_FOUND — retrying cannot help; the
repository or the environment must change.RATE_LIMITED.AUTH_FAILED after re-running the token exchange.UPLOAD_TIMEOUT blindly — re-uploading can double-submit.
Report it and suggest a longer --timeout.UPLOAD_REJECTED, PUBLISHER_FORBIDDEN,
ITEM_STATE_CONFLICT — each needs a human decision.{ "ok": true, "command": "release", "data": { "upload": {…}, "publish": {…}, "status": {…} } }
data holds the raw API responses, unchanged. For release, data.status is
the item’s final state: publishedItemRevisionStatus.state === "PUBLISHED"
means live.