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).
| Code | When it happens | Default message |
|---|---|---|
UNAUTHORIZEDFrom the API | The action needs a signed-in reader, or the session has expired. | Please sign in to continue. |
FORBIDDENFrom the API | The 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 API | The site owner has blocked this reader from posting and editing. | You are restricted from posting or editing on this site. |
REPLIES_CLOSEDFrom the API | Replies are closed on this post. | Comments are closed for this post. |
REPLY_CHANGEDFrom the API | The 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 API | The site is suspended. | This site is currently suspended. |
PLAN_MEMBER_DISABLEDFrom the API | An 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 API | The site has used up the image storage of its plan. | This site has reached its image storage limit. |
PLAN_LIMIT_SPACESFrom the API | The 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 API | The person is already a member of the site. | This person is already a member. |
AUDIENCE_NOT_FOUNDFrom the API | The member does not exist. | This member was not found. |
AUDIENCE_USER_NOT_FOUNDFrom the API | The 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 API | A 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 API | Someone 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 API | The 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 API | The 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 API | The 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 API | Replies are allowed one level deep; this was a reply to a reply. | You cannot reply to a reply. |
SLUG_CONFLICTFrom the API | Another post on the site already uses this slug. | This slug is already in use. Choose a different one. |
POST_NOT_FOUNDFrom the API | The post does not exist, was deleted, or is a draft the reader cannot see. | This post no longer exists. |
SPACE_NOT_FOUNDFrom the API | The 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 API | The comment does not exist or was deleted. | This comment no longer exists. |
INVALID_ATTACHMENTFrom the API | An 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 API | The `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 API | Another reader already uses this handle. | This handle is already taken. |
RESERVED_HANDLEFrom the API | The handle is reserved by Knit. | This handle is reserved. Choose a different one. |
INVALID_HANDLEFrom the API | The 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 API | The avatar image to save could not be found. | The avatar image could not be found. Upload it again. |
SOLE_OWNER_CANNOT_DELETEFrom the API | The 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 API | The reader has already reported this comment. | You have already reported this comment. |
CANNOT_REPORT_OWN_COMMENTFrom the API | Readers cannot report their own comments. | You cannot report your own comment. |
REPORT_NOT_FOUNDFrom the API | The report does not exist. | This report no longer exists. |
REPORT_ALREADY_PROCESSEDFrom the API | The owner has already handled this report. | This report has already been handled. |
CANNOT_BLOCK_OWNERFrom the API | Site owners cannot be blocked. | Site owners cannot be blocked. |
CANNOT_BLOCK_SELFFrom the API | Owners cannot block themselves. | You cannot block yourself. |
CANNOT_BLOCK_DELETED_USERFrom the API | The user has deleted their account. | Deleted users cannot be blocked. |
USER_ALREADY_SUSPENDEDFrom the API | The 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 API | The 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 browser | The image is not PNG, JPEG or WebP. Checked before uploading. | Only PNG, JPEG, and WebP images are supported. |
FILE_TOO_LARGEIn the browser | The image is larger than 5 MB. Checked before uploading. | Each image must be 5MB or smaller. |
PAYLOAD_TOO_LARGEFrom the API | The uploaded image is larger than the server accepts. | Each image must be 5MB or smaller. |
INVALID_IMAGE_CONTENTFrom the API | The uploaded file is not actually an image of the declared type. | The file is not a valid image. |
UPLOAD_URL_EXPIREDFrom the API | The signed upload URL expired before the upload finished. | The upload took too long. Please try again. |
UPLOAD_FAILEDIn the browser | Uploading the image file to storage failed. | Failed to upload image. |
AUTH_IN_PROGRESSIn the browser | A sign-in popup is already open. | Sign-in is already in progress. |
POPUP_BLOCKEDIn the browser | The 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 browser | The reader closed the sign-in popup. | Sign-in was cancelled. |
LOGIN_TIMEOUTIn the browser | Sign-in did not finish in time. | Sign-in timed out. Please try again. |
AUTH_STATE_MISMATCHIn the browser | The 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 browser | The 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.
| Code | Meaning |
|---|---|
SPACE_MISMATCH | The 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). |