Troubleshoot your app
Find the symptom, then follow the link for the detail. Every error name is listed in Error codes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Every request answers 401 | The request sends Authorization: Bearer | Use the OAuth session's fetch handler with the absolute Stratos URL |
NotEnrolled after OAuth | The service uses an allowlist and the user is not on it | Check zone.stratos.enrollment.status. The operator must grant access |
PdsCustodyWriteForbidden | The user has pds custody | Write with com.atproto.space.createRecord on the user's PDS |
| A boundary error on write | The boundary is missing, foreign, or not held | Put one full boundary from the user's enrollment in boundary.values |
| A PDS-custody write fails | The session lacks the space scope | Ask the user to sign in again |
| Posts missing from the feed | The viewer lacks the boundary, or the author left | Check the viewer's boundaries and the author's membership |
| Enrollment redirect fails | No client metadata document proves the redirect_uri | Publish client metadata and send client_id |
| JSON error after enrollment | Stratos refused the enrollment | Read the error in the JSON body |
| Requests reach the PDS | new Agent(session) with a changed serviceUrl | Wrap the session's fetch handler |
| 429 errors | The DID passed the write rate limit | Retry with exponential backoff |
| DPoP nonce errors | A proxy hides DPoP-Nonce | Expose the header through CORS |
RecordNotFound for a member | The viewer lacks the boundary, or the author has pds custody | Check boundaries. Read PDS-hosted posts through the feed generator |
fetchAndVerifyRecord fails | Stratos does not serve com.atproto.sync.getRecord | Use verifyRecordCid |
importRepo fails | The service registers no handler for it | Use com.atproto.repo.applyWrites |
Every request answers 401
Stratos accepts a user's request only with DPoP. Send Authorization: DPoP <access_token> and a DPoP proof header. A request with Authorization: Bearer <access_token> answers 401 AuthenticationRequired.
Use the fetch handler of your OAuth session and pass it the absolute Stratos URL. See DPoP-aware transport.
"NotEnrolled" after completing OAuth
The service may have an allowlist. Check the live status:
curl "https://stratos.example.com/xrpc/zone.stratos.enrollment.status?did=<your-did>"enrolled: false with eligible: false means the operator must grant access.
Writes fail with PdsCustodyWriteForbidden
The user has pds custody. Their records live on their own PDS, and Stratos refuses repo writes for them. Resolve the repository target and call com.atproto.space.createRecord on the PDS. See Custody and Routing.
Writes fail with a boundary error
See Writing records for every write error.
| Error | Fix |
|---|---|
InvalidDomainCount | Put exactly one entry in boundary.values. |
ServiceMismatch | Use a boundary of this Stratos service, with its service DID prefix. |
ForbiddenBoundary | Use a boundary from the user's enrollment. |
InvalidDomain | The boundary name is not a valid space key. |
A PDS-custody write fails
- Confirm the session holds the space scope. See Space scope.
- If the scope is missing, ask the user to sign in again.
- Confirm the
spaceURI starts with the Stratos service DID and uses the typezone.stratos.space.feed.
Posts not appearing in the feed
- Check that the viewer holds the post's boundary.
- Check the write response. A Stratos write returns the record URI.
- Allow the feed generator a moment to collect the post.
- For a PDS-hosted post, confirm the author is still a member. The feed generator reads only the repos of current members.
Enrollment redirect fails
After enrollment, Stratos returns the browser to the redirect_uri you sent to /oauth/authorize. You do not register that URL with the operator. You prove it is yours the same way you prove an OAuth redirect: publish a client metadata document and name it with client_id.
If the response is 400 InvalidRequest instead of a redirect:
- Confirm you sent
client_idwith the authorize request. - Confirm the
client_idURL useshttps, includes a path, carries no fragment, and names a hostname rather than an IP address. - Fetch your
client_idURL and confirm it returns JSON over HTTPS. - Confirm the document's own
client_idfield equals the URL it is served from. - Confirm
redirect_urisdeclares a URL on the same origin as yourredirect_uri. - Ensure the user's PDS supports ATprotocol OAuth.
Stratos reads the metadata document from its own server, not from the browser, so a CORS error in the browser console is unrelated to this response. The response body gives one fixed message for every read failure; the specific cause is in the service log.
If your app publishes no client metadata document, ask the operator to add your origin to STRATOS_ALLOWED_REDIRECT_ORIGINS. Publishing the document is preferred, because it needs no operator action.
The browser stops on a JSON error after enrollment
Stratos does not redirect a failed enrollment back to your app. The browser stays on the Stratos origin and shows a JSON body such as { "error": "EnrollmentDenied" }. Your app receives no error query parameter. See Handling the result.
Requests go to the PDS instead of Stratos
You are likely using new Agent(session) and then setting serviceUrl. Use the fetch handler wrapper instead. See Write the post.
Rate limiting (429 errors)
Use exponential backoff. The default limit is 300 writes per 60-second window per DID. An applyWrites call counts each write in the batch.
DPoP nonce errors
On a use_dpop_nonce error, read the nonce from the DPoP-Nonce response header and include it in the next proof. If a proxy sits in front of Stratos, confirm it passes DPoP-Nonce through Access-Control-Expose-Headers.
A record reads as RecordNotFound for an enrolled user
The viewer may not hold the record's boundary. Stratos answers HTTP 400 with error: "RecordNotFound" for a missing record and for a denied one. The status is not 404 and not 403.
Also check custody. Stratos read methods serve only Stratos-hosted records. A pds-custody author's posts are on their PDS; read them through the feed generator.
A moderation service may have taken down the record or the author's account. Both read as a missing record, for every viewer. A service with a service enrollment can read the label with zone.stratos.moderation.queryLabels.
fetchAndVerifyRecord fails
fetchAndVerifyRecord calls com.atproto.sync.getRecord, which the Stratos service does not serve. Use verifyRecordCid on a getRecord response. See Verifying what you read.
importRepo fails
The zone.stratos.repo.importRepo lexicon exists, but the service registers no handler for it. Write records with com.atproto.repo.applyWrites instead.
CORS and header requirements
A browser client calls Stratos across origins. The Stratos service sets these headers itself. Check them when a proxy or gateway sits in front of it.
Stratos reflects the request origin in Access-Control-Allow-Origin.
Allowed request headers (Access-Control-Allow-Headers):
Authorization: carries the DPoP-bound access tokenDPoP: carries the DPoP proof JWTDPoP-NonceContent-TypeSignature,Signature-Input,Atproto-Space-Audience: space credential requestsatproto-accept-labelers,atproto-proxy-typex-trace-id
Exposed response headers (Access-Control-Expose-Headers):
DPoP-Nonce: required for DPoP nonce rotationWWW-Authenticate: required for DPoP error recoveryx-trace-id
CORS flow
- The browser sends a preflight
OPTIONSrequest. - Stratos answers 204 and lists
AuthorizationandDPoPas allowed headers. - On the real response,
DPoP-Nonceis exposed, so the client can read the server's nonce.
CORS failure symptoms
| Missing header | Symptom |
|---|---|
DPoP not in allowed headers | Preflight fails. Every authenticated request shows a CORS error. |
DPoP-Nonce not exposed | The client cannot read the nonce. Proofs use a stale nonce and loop on 401. |
WWW-Authenticate not exposed | The client cannot parse use_dpop_nonce. |
Authorization not in allowed headers | The access token is never sent. Every request answers 401. |
Known pitfalls
Async discovery race condition
If enrollment discovery is fire-and-forget, an account switch can leave stale enrollment data:
// Problem: if the user switches accounts before discovery completes,
// setEnrollment updates state for the wrong account.
getEnrollmentByServiceDid(did, pdsUrl, serviceDid)
.then(setEnrollment)
.catch(() => setEnrollment(null))Key discovery to the active session and cancel on account change:
// React pattern
useEffect(() => {
let cancelled = false
getEnrollmentByServiceDid(did, pdsUrl, serviceDid).then((enrollment) => {
if (!cancelled) setEnrollment(enrollment)
})
return () => {
cancelled = true
}
}, [did, pdsUrl, serviceDid])Both fragments assume getEnrollmentByServiceDid from @northskysocial/stratos-client, React's useEffect, and a setEnrollment state setter in your component.
Reading the author from a space URI
A space record URI starts with the authority DID, not the author. The author is the fourth part after at:space/. Code that splits a URI and takes the first part shows the Stratos service as the author of every PDS-hosted post. Use parseRecordAddress from @northskysocial/stratos-client.
Verification level ambiguity
A record read from Stratos can be checked for CID integrity only. That confirms the content matches its CID. It does not confirm a signature. Do not label it "verified" without a qualifier.
Empty repo versus missing repo
For stratos custody, enrollment creates a repo with an empty signed commit. An empty collections list from describeRepo is the normal state before the first post.
RepoNotFound means Stratos hosts no repo for that DID. That is expected for a pds-custody user. For a stratos-custody user it is an error. Check custody before you decide.
DPoP htu claim accuracy
The DPoP proof's htu claim must match the request URL. Pass the absolute target URL to the session's fetch handler, not a relative path. A relative path resolves against the session's PDS.