- HTML Clay
- Docs
- Host reference
- Troubleshooting
Troubleshooting
Error messages, dialogs, and HTTP responses you can encounter in HTML Clay, what causes each one, and how to fix it.
This page lists the error messages, dialogs, browser pages, and HTTP statuses HTML Clay can show, grouped by area.
Starting up and ports#
See Opening files and addresses and Configuration.
HTML Clay can't start:Port N is in use by X (PID n).(orPort N is in use, and HTML Clay could not tell by which program. On Windows this can also mean the port sits in a range reserved by Hyper-V or WSL.) Another process is holding the port saved inconfig.json. Click Quit It and Retry (or Retry), or click Use a New Port to move HTML Clay to the next free port from its candidate list (1212,4545,9797,3434,1111).HTML Clay can't start:HTML Clay could not find a free port. It tried [1212 4545 9797 3434 1111] and 20 random ports on this computer, and every one was in use.Every candidate port and 20 random ports between10000and32767could not be bound on loopback. Check local firewall rules or Windows Hyper-V/WSL excluded port ranges, free a port, and launch HTML Clay again.HTML Clay now uses port N instead of M. Bookmarks with the old port stop working, and anything pages stored in the browser under the old address starts over.You chose Use a New Port when the previous port was busy. Update your browser bookmarks to use the new port number.[htmlclay] config.json is corrupt (...); saved it as ... and starting from defaultsPrinted to standard error whenconfig.jsoncontains invalid JSON. HTML Clay renames the broken file toconfig.json.corrupt-<unix-time>and resets to defaults. Inspect the backup file if you want to restore your previous settings.- Linux prompt error (
... Until then, a file opened from outside a trusted folder is refused, because the prompt that would allow it cannot be shown.) HTML Clay needszenityorkdialogon Linux to display native permission dialogs. Installzenityorkdialogwith your distribution’s package manager, or open files from a trusted folder.
Opening files, addresses, and trusted folders#
See Opening files and addresses and Trusted folders.
HTML Clay can't open this file:<name> is outside your home folder. HTML Clay only opens files inside <home>.You opened a file located outside your user home directory. Move the file into a folder inside your home directory and open it again.HTML Clay is running / Each folder you open has its own address ending in .localhost. Nothing is served at this one.You navigated to barelocalhost:<port>,127.0.0.1:<port>, or[::1]:<port>. Double-click a file in Finder or your file manager, or use the HTML Clay tray menu, so it opens at its<slug>.localhost:<port>folder address.Nothing is open at this addressYou opened a bookmarked.localhostaddress whose folder is not currently active. Double-click the file in your file manager to open it, or add its folder under Trusted Folders in the tray menu.This trusted folder needs approving againA trusted folder was moved, deleted, or replaced on disk, so its stored identity no longer matches. Open the tray menu and choose Trusted Folders then Trust a Folder… to approve it again.This file is outside this folder(HTTP403, headerX-HTMLClay-Error: outside-folder) You navigated in the browser to a file path outside the folder served by the current.localhosthostname. Open that file from your file manager so HTML Clay serves it on its own folder address.Read access required(HTTP403, headerX-HTMLClay-Error: read-access-required) A page tried to fetch or embed a file outside its permitted folder and read permission was not granted. Reload the page and choose Allow Once or Trust This Folder when prompted.Read-only view. This file was opened from a link.You reached a.htmlclaydocument by following a link rather than opening it from your file manager or a trusted folder. Click Trust this folder in the banner to make it editable, or double-click the file in your file manager. If the banner saysThis offer expired. Reload the page to ask again., the 10-minute prompt token expired; reload the tab and click Trust this folder again.<dir> was not trusted. A page requested it, and it is one of your main personal folders...A page asked to trust a top-level personal folder such asDocumentsorDesktop. Pages cannot request trust for main personal folders. Move the file into a dedicated project folder, or add the folder yourself from Trusted Folders in the tray menu.<dir> was not added to your trusted folders. ... It stays readable until you quit. You can add it yourself from the HTML Clay menu.You declined the trust dialog orconfig.jsoncould not be saved. Add the folder from Trusted Folders in the tray menu when you want permanent write access.
Saving, uploads, and exports#
See Server endpoints and save protocol, Uploads and assets, and Export as zip.
<file> had been changed outside this tab. Your version was saved; the previous one is in Backups.(HTTP200warning) Your save had noIf-Matchstamp and overwrote an external change on disk. You can restore the overwritten copy from Backups and recovery.<file> changed since you last loaded it. Your version was not saved.(HTTP412, codeconflict) The file on disk changed since your tab loaded or last saved it. Use the conflict bar on the page to choose Keep mine, Accept theirs, or Download my copy (see Conditional saves and receipts).body too large (max 50MB)(HTTP413) The HTML document being saved is larger than 50 MB. Upload large images and attachments through uploads instead of embedding them asdata:URLs.empty body,body is not an HTML document(HTTP400), or/_/save takes the document as text, not JSON.(HTTP415) The request sent to/_/savewas empty, not valid HTML, or sent with a JSON content type instead of plain HTML text.the file was just emptied on disk; retry once that change reaches the page(HTTP409) Another tool truncated the file on disk while your save was starting. Wait a moment for the disk change to settle and save again.invalid token(HTTP401) The document’s save token is no longer valid, for example because you stopped trusting its folder. Reopen the file through HTML Clay.HTML Clay is restarting to finish an update, so nothing was saved. Try again in a few seconds.(HTTP503, coderestarting) A save arrived while HTML Clay was restarting into a new version. Wait a few seconds and save again.File too large (max 25MB)(HTTP413, codetoo-large) An uploaded file is over the 25 MB per-file limit. Compress or resize the file before uploading.That kind of file cannot be uploaded(HTTP415, codeunsupported-type) HTML Clay refuses uploads of HTML, XML, and JavaScript files (such as.html,.htmlclay,.xml,.js, and.mjs). Upload non-executable assets only.Expected one file part named "file"orEmpty file(HTTP400) The upload request did not contain afilemultipart field or the uploaded file was 0 bytes.<key> in <dir> is N bytes, want 32: delete it and upload againThe secret file~/htmlclay/uploads/.library-keyis damaged. Delete~/htmlclay/uploads/.library-keyand retry the upload so HTML Clay generates a fresh 32-byte key.That file is no longer open.orCouldn't export <name>.When choosing Export as Zip, the document was closed after the menu opened, or HTML Clay could not write to~/Downloads. Reopen the document in HTML Clay and verify that~/Downloadsexists and is writable.
Updates#
See Updates.
HTML Clay could not restart into vX just now, so it is still running vY. Try Restart to Update again in a moment.The update restart could not complete. Click Restart to Update in the tray menu again.The update to vX has not started yet, so HTML Clay is still running vY. It finishes the next time HTML Clay quits.On macOS, Sparkle did not finish quitting the app within 40 seconds. Quit HTML Clay normally when you are ready to complete the update.Self-update is off: <reason>(inhtmlclay.logor fromhtmlclay update-now) Automatic updates are disabled because"updates": "off"is set inconfig.json, HTML Clay is running with-no-tray, the install folder is not writable, or on macOS the app is translocated outsideApplications. MoveHTML ClaytoApplicationson macOS, or click Update available: vX.Y.Z in the tray menu to download the new version manually.
Live sync#
See Live sync between tabs and ClayJS live sync.
- Nothing updates in the open tab when the file changes on disk
Check that your document’s ClayJS
<script>tag loadssync(for example,clay.js?plugins=sync). Reload the tab after adding the plugin, and verify that the tab’s address bar showshttp://<slug>.localhost:<port>/...rather thanfile://. - Your words in the document were replaced by an outside change The external edit and your unsaved edit modified the same text. Keep concurrent edits in separate elements, or restore your replaced text from the conflict notice that appears on the page.
JSON over HTTP#
See JSON over HTTP and ClayJS data: pages as JSON.
400(Write rejected) for an unknown key or unmatched selector The JSON payload contains a key not defined in the extraction rules, or the rule’s selector matched nothing in the document. Send only keys defined in the rules and verify the target elements exist.400for thedataparameter or rules tag Thedataquery parameter is empty, malformed, or repeated, or the embedded<script data-rules-name="api">tag does not havedata-rules-version="1". Also check that your selector uses only supported pseudo-classes and operators (for example,["sel", {"name": "@name"}]instead ofsel@name[]).400(Write refused) The write targeted an unsafe or forbidden target, such as anon*event attribute,style,srcdoc,@innerHTML,@outerHTML, ajavascript:ordata:URL, an element inside<script>or<head>, or a region marker (no-save,editor-ui). Adjust your rules to target ordinary content elements and attributes.400(Cannot grow list) You sent new items for a list that is currently empty in the HTML and has nocms-templateseed to clone. Keep at least one item in the list or add a template seed.405on aPOSTto the file’s own address Include the?data=query parameter on the URL, or send thePOSTto/_/api/<path>.403(Not writable) on a write The target file is not currently open in HTML Clay and is not a.htmlclayfile in a trusted folder. Open the file in HTML Clay first. If sending the request from a browser script on the same origin, include the document’sSave-Tokenheader.404(No open folder) on127.0.0.1:<port>/_/api/<path>No open folder in HTML Clay serves that file path. Open the file in HTML Clay first, or runhtmlclay wire where <file>to see its folder address.412on a write withIf-MatchThe file on disk changed since you read itsETag. Read the file again, apply your change to the new data, and retry with the newETag.- PowerShell
Invoke-RestMethodfails withremote name could not be resolvedWindows system DNS does not always resolve*.localhostnames for CLI tools. Send the request tohttp://127.0.0.1:<port>/_/api/<home-relative-path>instead.
Document programs and the wire CLI#
See Document programs and The wire CLI.
open it firstorhas never served this file's folderin the terminal Open the document in HTML Clay at least once so its folder is registered, then runhtmlclay wire serveagain.no agent is attached to this fileon the page If you attached a program from the terminal, check thathtmlclay wire serveis still running. If you are using a named document program, check that<meta name="htmlclay-helper" content="<name>">appears in the first 512 KiB of<head>and matches thehelpername inclay.wire.send.was not granted that helperon the page You declined the helper prompt, or you reached the document via a link rather than opening it directly. Double-click the.htmlclayfile in your file manager to open it directly and choose Allow for This Document or Allow for Any Document.- The page stays on its loading state and never receives a JSON result
Stop
htmlclay wire serveand restart it with--protocol=jsonl, then reload the page. Without--protocol=jsonl, HTML Clay treats standard output lines as plain progress text instead of JSON result records. Write diagnostic messages to standard error (stderr) and keep result records under 512 KiB.
AI editing#
See AI editing and ClayJS ai-edit.
- The bar says an agent was not found or is not signed in
Install Claude Code or Codex on your computer and sign in from your terminal, then send the request again. HTML Clay falls back between Claude Code and Codex only when the default CLI is missing; an explicit
@agentprefix or a sign-in failure never falls back. - Unknown
@namein the prompt Remove the@nameprefix to use your default agent, use@fableor@codex, or define the custom engine underaiEdit.enginesinconfig.json. (@agyis always refused because it can read files without asking.) - AI editing is turned off, with no Send button Enable AI Editing in the HTML Clay tray menu.
- Pressing
Cmd+J(Ctrl+Jon Windows and Linux) does nothing Check that the document loads ClayJS with?plugins=ai-edit, is open through HTML Clay in edit mode, and that you have selected text inside a content element. If your browser captures the shortcut, click the AI chip next to your selection. - Another request is running Each document runs one AI edit at a time. Wait for the current edit to finish, or click Stop in the bottom bar.
- Reply refused for adding code,
reply is not a singleelement, orthe model declined this requestClayJS refuses any reply that introduces<script>, inline event handlers,javascript:URLs,srcdoc, or new<iframe>,<frame>,<object>, or<embed>elements. Ask again without requesting executable code, or rephrase the request. - The selected element is too large Select text inside a smaller element, such as a single paragraph or list item. Selecting fewer words inside the same large container still sends that whole container.
- A request stops after five minutes Each AI edit has a 5-minute time limit. When it expires, HTML Clay stops the agent and restores the original content.
- Attachment (
@name.ext) refused Attached files must be regular, non-hidden files inside the document’s folder (up to 8 files, at most 256 KiB each and 1 MiB total). Missing files, hidden files (such as.envor.git), and symlinks resolving outside the folder stop the request. HTML Clay stopped this edit.You unchecked AI Editing in the tray menu or quit HTML Clay while the request was running.- Clicking Keep reports a save error The rewrite is visible on the page, but saving to disk failed or hit a conflict. Copy the rewritten text before reloading or closing the tab, then resolve the save error and save again.