Skip to content

At a glance

Audience
App developers and operators
Type
Reference
Status
current

At a glance

Audience
App developers and operators
Type
Reference
Status
current

Error codes ​

Every error the Stratos service returns, by area. The feed generator has its own errors. They are listed in Run the feed generator.

Error structure ​

Stratos returns standard XRPC errors.

json
{
  "error": "ForbiddenBoundary",
  "message": "Boundary 'did:web:stratos.example.com/writers' not allowed"
}

Match on the error name, not the message. Most rejections use HTTP 400. The tables give the status of each error.

Authentication and limits ​

ErrorStatusMeaning
AuthenticationRequired401No valid DPoP-bound session, a fresh DPoP nonce is needed, or the caller wrote to another user's repository
NotEnrolled400The caller's identity is valid, but they have no active enrollment with the service
RateLimitExceeded429The DID passed the write rate limit. Back off, then retry.

Stratos accepts Authorization: DPoP <token> with a DPoP proof header. A Bearer token is not a valid user credential.

When a response carries a DPoP-Nonce header, retry once with that nonce in the proof. OAuth client libraries do this for you.

Writing records ​

ErrorStatusMeaning
InvalidDomainCount400The record does not carry exactly one boundary
InvalidDomain400The boundary name is not a valid space key
ServiceMismatch400The boundary belongs to a different Stratos service
ForbiddenBoundary400The caller does not hold the boundary
InvalidRecord400The record does not match its lexicon
InvalidCollection400The collection is not allowed on this procedure
PdsCustodyWriteForbidden400The user's records are kept on their own PDS. Write there instead.
ServiceWriteForbidden400The caller is a service identity. Services can read but never write.
InvalidSwap400A swapCommit or swapRecord condition did not match
ConcurrentModification400Another write to the same repository won the race. Retry.

PdsCustodyWriteForbidden is not a failure of your user. It means your app sent the write to the wrong place. Resolve the repository target from the enrollment's custody first. See Your First Post.

Writing into a boundary ​

The zone.stratos.repo.createRecord, putRecord, deleteRecord and applyWrites procedures take the boundary as a parameter. They return NotEnrolled, ServiceWriteForbidden, PdsCustodyWriteForbidden, ForbiddenBoundary, InvalidDomain, ServiceMismatch, InvalidCollection and RateLimitExceeded as in the tables above. They do not return InvalidDomainCount or the swap errors. They allow posts, likes and reposts. com.atproto.repo.* allows only zone.stratos.* collections and answers InvalidCollection for a like or repost.

ErrorStatusMeaningWhat the client does
BoundaryMismatch400The record body claims a boundary other than the one in the requestLeave the boundary field out of the record, or make it match
BoundaryNotFound400The caller holds the boundary, but it is absent or inactiveChoose a boundary from the user's enrollment
RecordAlreadyExists400The key is taken, or the member already likes or reposts that postUse another rkey, call putRecord, or delete the existing record
RecordNotFound400An update or delete in applyWrites named a record that is not thereRefresh the record list, then send the batch again
PayloadTooLarge413The body or the commit's sync frame is over its limitSend fewer writes in each applyWrites call
ScopeUpgradeRequired400The member's grant predates the collection of a like or repostSend the member through OAuth authorization again. Do not retry first
InvalidRecord400For a like or repost: The subject must be a post in this boundaryUse the uri and cid of a post in the same boundary, as served
InvalidRecord400For a reply: the parent cannot be read in this boundaryReply in the boundary of a parent that the member can read

The reply message starts with Reply boundaries must be a subset of the parent's boundaries and names the reply's boundary. It is the same for every parent the reply cannot have. A parent in another boundary, a parent that Stratos holds but cannot find, and a parent that is taken down all return it, byte for byte. The error does not tell them apart. Stratos reads the parent's boundary from its store at the time of the write, so a reply to a parent that has just moved is refused at once. The older com.atproto.repo methods do not check a parent that is missing or taken down.

The subject message is the same for every wrong subject, whatever the validate value. A subject that is not a { uri, cid } reference, a post that Stratos holds but cannot find, a post in another boundary, a URI that is not canonical and a wrong CID all return it. The error does not tell them apart.

For a post by a member who hosts their own repo, Stratos does not hold the record. It checks neither that the record exists nor its CID. subject.cid must still be a valid CID. Stratos checks that the author is an active member of the boundary who hosts their own repo, and that the URI is well formed for that boundary.

ScopeUpgradeRequired is returned only when the member's stored grant has a space grant for this service that lacks the collection. See Differences from the upstream procedures.

RecordNotFound also appears when reading. There it also covers a record that the caller may not read, a record that is taken down, and every record of a taken-down account.

Reading records ​

ErrorStatusMeaning
RecordNotFound400The record does not exist, or the caller may not read it
RecordBlocked400The caller may not read the record. Sent by zone.stratos.repo.hydrateRecord only.
RepoNotFound400No such repository on this service, or the caller does not own it (getRepo)
BlobNotFound400The repository has no such blob
BlobBlocked400The caller may not read the blob
TooManyUris400A batch hydration request named more than 100 records

Why "not found" also means "not allowed" ​

com.atproto.repo.getRecord and zone.stratos.space.getRecord give the same answer for a record that does not exist and a record the caller may not read. Both are RecordNotFound.

This is deliberate. A distinct "forbidden" answer would confirm that a private record exists. A stranger could then map a community's activity without reading a single post.

Note the status: RecordNotFound arrives with HTTP 400, not 404. Match on the error name.

Space credentials ​

ErrorStatusMeaning
AuthRequired400No session and no delegation token
InvalidToken400The delegation token or client attestation did not verify, or it names another space
ProofRequired400No key proof to bind the credential to
UnknownSpace400The space URI is malformed, or not a space of this service, or the boundary is not active. A space URI in the earlier spelling is malformed
NotEnrolled400No active enrollment that holds the space's boundary
AttestationRequired400The space has an app allow-list and no attestation was presented
ClientNotAllowed400The attested client_id is not on the allow-list

These come from zone.stratos.space.getSpaceCredential. UnknownSpace is also the answer when the boundary changes while the request is authorized. The space read endpoints answer AuthRequired with HTTP 401 when the caller is not admitted to the space.

See Permissioned Spaces.

Repo update notices ​

A member's PDS sends com.atproto.space.notifyRepoUpdate after a write to a space repo. Stratos acknowledges a valid notice with an empty 200 and stores nothing.

ErrorStatusMeaning
AuthenticationRequired401No service JWT, or one with another lxm, another audience, an expired or non-numeric exp, the type of an access token, refresh token or DPoP proof, or a signature not made by the issuer's #atproto key
RateLimitExceeded429The writer sent more than 1,500 notices in an hour or 10,000 in a day. Back off, then retry.
InvalidRequest400The body is not JSON, or repo is not a DID, repoRev is not a TID, or data is not bytes
UnsupportedMediaType415The body is in a charset that is not a UTF encoding, or in a content encoding the service does not read
PayloadTooLarge413The body is over 100 kB
Forbidden403The token's iss is not repo; or repo is not an active pds-custody member, other than a service, who holds the space's boundary; or that boundary is not active. Every case but the first has one message, so it does not tell an outsider whether the boundary exists
SpaceNotFound400The space is malformed, belongs to another authority or has another type. A space URI in the earlier spelling is malformed
FutureRev400repoRev is more than five minutes ahead of the service clock. Only a writer of the space gets this answer

Every other upstream com.atproto.space.* method, such as listWriters, answers 501 MethodNotImplemented.

Enrollment ​

Enrollment happens in the browser, through /oauth/authorize and /oauth/callback. When the service refuses an enrollment, the callback responds on the Stratos origin with a JSON error:

ErrorStatusMeaning
EnrollmentDenied403The user may not enroll, for example they are not on the allowlist
InvalidState400The OAuth state is missing or expired. Start the flow again.
CallbackError500The callback failed for another reason

A successful enrollment redirects back to your app with ?stratos_enrolled=true.

Moderation labels ​

zone.stratos.moderation.createLabel returns these errors to a moderation service:

ErrorStatusMeaning
SubjectNotFound400The subject record or account does not exist on this service
SubjectCidNotSupported400The record subject carries a cid. A takedown applies to every version of a record. Send it without one.

A malformed subject, value or space returns InvalidRequest.

Sync ​

ErrorStatusMeaning
OplogTruncated400listRepoOps cannot serve that position. Recover with listRecordPaths.
FutureCursorDeclared by the subscribeRecords lexicon. Stratos does not send it. See the note below.

A subscribeRecords cursor ahead of the newest event does not fail. Stratos resumes the stream from the newest event. A cursor older than the retained events gets an OutdatedCursor info frame, and the stream continues.

Handling errors in a client ​

An XRPC client surfaces the name as error:

typescript
import { XRPCError } from '@atproto/xrpc'

try {
  await stratos.com.atproto.repo.createRecord(input)
} catch (err) {
  if (!(err instanceof XRPCError)) throw err

  switch (err.error) {
    case 'NotEnrolled':
      // send the user through enrollment
      break
    case 'PdsCustodyWriteForbidden':
      // route the write to the user's PDS
      break
    case 'RateLimitExceeded':
      // back off and retry
      break
    default:
      throw err
  }
}