Error codes

Every error from Knit carries a code. Readers see a text chosen from the code, never the raw message (see Languages).

Error objects

Errors thrown by @knit/core and @knit/react are KnitError objects with a code and an English message for developers. Errors from the API are KnitRequestError, which also has:

  • status: the HTTP status.
  • retryAfterSeconds: seconds to wait, when the request was rate-limited (HTTP 429).
  • details: extra data for some codes.

Rate-limited requests are shown with messages.errors.rateLimited, which receives the seconds to wait.

Codes with their own text

These codes have a default English text in messages.errorCodes. Codes not listed here are shown with the generic text for the action (messages.errors).

CodeWhen it happensDefault message
UNAUTHORIZEDFrom the APIThe action needs a signed-in reader, or the session has expired.Please sign in to continue.
FORBIDDENFrom the APIThe reader is signed in but lacks permission, such as editing someone else's post.You do not have permission to do this.
USER_BLOCKEDFrom the APIThe site owner has blocked this reader from posting and editing.You are restricted from posting or editing on this site.
REPLIES_CLOSEDFrom the APIReplies are closed on this post.Comments are closed for this post.
REPLY_CHANGEDFrom the APIThe pending reply was edited just before you approved it. Review it again and retry.This comment was edited just now. Review it again before approving.
SITE_SUSPENDEDFrom the APIThe site is suspended.This site is currently suspended.
PLAN_MEMBER_DISABLEDFrom the APIAn editor who is not the owner tried an owner action, but the site's plan has no member seats.Member editing is not available on this site's current plan.
PLAN_LIMIT_STORAGEFrom the APIThe site has used up the image storage of its plan.This site has reached its image storage limit.
PLAN_LIMIT_SPACESFrom the APIThe site's plan (Free) does not allow new posts in a non-public space (members or participants), or adding and changing members. Existing posts stay readable.This site's current plan does not allow new posts in non-public spaces, or adding and changing members.
AUDIENCE_ALREADY_MEMBERFrom the APIThe person is already a member of the site.This person is already a member.
AUDIENCE_NOT_FOUNDFrom the APIThe member does not exist.This member was not found.
AUDIENCE_USER_NOT_FOUNDFrom the APIThe person has never signed in to this site, so they cannot be added as a member.This person has not signed in to this site.
SPACE_WIDEN_UNCONFIRMEDFrom the APIA change would make existing posts readable by more people and was not confirmed. The error details carry the post and reply counts; show them and resend with confirmWiden.This change needs to be confirmed first.
SPACE_SETTINGS_CHANGEDFrom the APISomeone else changed the space's settings while this change was being made, or while a widening confirmation was open. Reload the settings and try again.The space settings were changed by someone else. Reload and try again.
INVALID_SPACE_ACCESSFrom the APIThe space settings let people write who cannot read (for example a members-only space writable by any signed-in reader).People who cannot read a space cannot write to it.
AUDIENCE_LIMIT_REACHEDFrom the APIThe site already has the maximum number of members (500). Remove some before adding more.This site has reached its limit of 500 members.
NG_WORD_DETECTEDFrom the APIThe text contains a word on the site's blocked word list.Your text contains a word that is not allowed on this site.
MAX_REPLY_DEPTH_EXCEEDEDFrom the APIReplies are allowed one level deep; this was a reply to a reply.You cannot reply to a reply.
SLUG_CONFLICTFrom the APIAnother post on the site already uses this slug.This slug is already in use. Choose a different one.
POST_NOT_FOUNDFrom the APIThe post does not exist, was deleted, or is a draft the reader cannot see.This post no longer exists.
SPACE_NOT_FOUNDFrom the APIThe space key does not exist on this site. Spaces are created in the Console; the API never creates one from a typo.This content area does not exist.
COMMENT_NOT_FOUNDFrom the APIThe comment does not exist or was deleted.This comment no longer exists.
INVALID_ATTACHMENTFrom the APIAn attached image was not uploaded to this site, or no longer exists.One of the attached images is invalid. Remove it and try again.
POST_TYPE_NOT_ALLOWEDFrom the APIThe `typeKey` is not allowed here: a root post can only use its space's root type, and a reply can only use a reply type that the root post's space allows.This kind of post can't be made here.
HANDLE_CONFLICTFrom the APIAnother reader already uses this handle.This handle is already taken.
RESERVED_HANDLEFrom the APIThe handle is reserved by Knit.This handle is reserved. Choose a different one.
INVALID_HANDLEFrom the APIThe handle is not 3–30 characters of lowercase letters, numbers, hyphens or underscores.Handles must be 3-30 characters of lowercase letters, numbers, hyphens, or underscores.
INVALID_AVATARFrom the APIThe avatar image to save could not be found.The avatar image could not be found. Upload it again.
SOLE_OWNER_CANNOT_DELETEFrom the APIThe account is the only owner of a site, so it cannot be deleted yet. Transfer the site to someone else in the Knit console, or delete it (a paid plan is canceled right away, without a refund).You cannot delete your account while you are the sole owner of a site. Transfer the site to someone else, or delete it, first.
ALREADY_REPORTEDFrom the APIThe reader has already reported this comment.You have already reported this comment.
CANNOT_REPORT_OWN_COMMENTFrom the APIReaders cannot report their own comments.You cannot report your own comment.
REPORT_NOT_FOUNDFrom the APIThe report does not exist.This report no longer exists.
REPORT_ALREADY_PROCESSEDFrom the APIThe owner has already handled this report.This report has already been handled.
CANNOT_BLOCK_OWNERFrom the APISite owners cannot be blocked.Site owners cannot be blocked.
CANNOT_BLOCK_SELFFrom the APIOwners cannot block themselves.You cannot block yourself.
CANNOT_BLOCK_DELETED_USERFrom the APIThe user has deleted their account.Deleted users cannot be blocked.
USER_ALREADY_SUSPENDEDFrom the APIThe user is already suspended across Knit, so there is no need to block them on the site.This user is already suspended.
TARGET_COMMENT_MISSINGFrom the APIThe reported comment was deleted, so its author cannot be blocked from the report.The reported comment has been deleted, so its author cannot be identified.
UNSUPPORTED_FILE_TYPEIn the browserThe image is not PNG, JPEG or WebP. Checked before uploading.Only PNG, JPEG, and WebP images are supported.
FILE_TOO_LARGEIn the browserThe image is larger than 5 MB. Checked before uploading.Each image must be 5MB or smaller.
PAYLOAD_TOO_LARGEFrom the APIThe uploaded image is larger than the server accepts.Each image must be 5MB or smaller.
INVALID_IMAGE_CONTENTFrom the APIThe uploaded file is not actually an image of the declared type.The file is not a valid image.
UPLOAD_URL_EXPIREDFrom the APIThe signed upload URL expired before the upload finished.The upload took too long. Please try again.
UPLOAD_FAILEDIn the browserUploading the image file to storage failed.Failed to upload image.
AUTH_IN_PROGRESSIn the browserA sign-in popup is already open.Sign-in is already in progress.
POPUP_BLOCKEDIn the browserThe browser blocked the sign-in popup. Open sign-in only from a click.The sign-in popup was blocked. Allow popups for this site and try again.
LOGIN_CANCELLEDIn the browserThe reader closed the sign-in popup.Sign-in was cancelled.
LOGIN_TIMEOUTIn the browserSign-in did not finish in time.Sign-in timed out. Please try again.
AUTH_STATE_MISMATCHIn the browserThe popup's response did not match the sign-in that was started (PKCE state check).Sign-in could not be verified. Please try again.
AUTH_POPUP_ERRORIn the browserThe sign-in popup reported an error.Sign-in failed. Please try again.

Codes for developers

These codes point to a mistake in the code that calls Knit. They have no text of their own and are shown with the generic text for the action.

CodeMeaning
SPACE_MISMATCHThe space of a reply does not match the space of the post it replies to. Pass the space of the thread (the root post's space).