Contents

Troubleshooting

The editor does not appear

  • The page is opened from file://. ES modules need HTTP; use a local web server.
  • The module path is wrong. Open the browser console: a 404 for index.js or one of its imports means the assets/ directory is not public or the path in the import is wrong. The modules import each other with relative paths, so keep the directory structure.
  • The CSP blocks the script. The console shows “Refused to execute inline script”. Give the <script type="module"> a nonce allowed by script-src.
  • The files come with the wrong MIME type. Some servers send .js as text/plain; browsers refuse such modules. Serve .js as text/javascript.

Content changes after saving

Compare editor.getContent() with the result of HtmlSanitizer::sanitize():

  • Classes disappear: the class is not in the sanitizer. Pass the same styles to allowStyles() as to the editor.
  • Line breaks differ: the form post turned \n into \r\n; this is normalized by sanitize(). If you compare strings yourself, normalize them too.
  • A custom plugin’s element disappears: register it in the PHP sanitizer as well. See HTML sanitizer.
  • Ids disappear: only ve- prefixed ids are allowed.

LengthException on save

The content is larger than maxLength (1 MB by default). Usually it means images pasted as base64 by another tool; configure upload so that images become files. Otherwise raise the limit in the constructor.

A licence notice on the production site

  • missing: no licenseKey in the editor options.
  • domain: the key was issued for another domain. Subdomains are covered; a different domain needs a key that includes it.
  • expired: the installed version was released after your update period (a security-only release: it belongs to an X.Y version released after your update period, or was released after that version's support ended). Install a version from your update period or renew updates.
  • invalid: wrong format or signature, for example a key copied incompletely or with a line break inside (spaces at the ends do not matter). An invalid key also blocks AI functions on local addresses.
  • unverified: the page is served over HTTP (no WebCrypto) or PHP has no OpenSSL, so the signature cannot be checked and the key is not accepted. Use HTTPS (or localhost) and enable OpenSSL.

See Licence.

AI buttons are missing

  • ai.url is not set in the editor options.
  • The licence is a Pro licence (AI needs the AI edition; on local and test addresses AI needs a trial key or an AI edition key).
  • The user’s aiFeatures do not include the function; the editor asks the server with the config action and hides the rest.
  • The API key of the chosen model’s provider is empty: aiAnthropicKey (ANTHROPIC_API_KEY) for a claude-… model, aiApiKey (OPENAI_API_KEY) for any other. A key of the other provider does not count. See Supported AI models.

AI requests fail

MessageCause
Invalid CSRF token. Reload the page.the token in ai.csrfToken does not match the session (expired session, a cached page)
POST request required.something rewrites the request (a redirect from http to https, a trailing slash)
The request is too large.the selection or document is larger than aiMaxRequest
AI functions require an AI Edition licence.the server-side licenseKey is missing or a Pro key
This AI function is not available for your account.aiFeatures excludes it (HTTP 403)
The AI usage limit has been reached. Try again later.aiBeforeRequest refused it (HTTP 429)
The AI service API key is invalid. Check the configuration.the provider rejected the key, for example a Claude key in aiApiKey or an OpenAI key in aiAnthropicKey
The AI service account has run out of credit.no credit in the provider’s account (with Anthropic: “credit balance” in the PHP error log)
The AI model from the configuration is not available for this API key.aiTextModel is misspelled or the key’s account has no access to the model (HTTP 403 or 404)
The AI service rejected the request.another error reported by the provider (HTTP 400); details are in the PHP error log

Provider errors (a wrong API key, no credit, a timeout) are logged in the PHP error log without the key; the user sees a short message. A model outside the tested list adds a one-time warning “has not been tested with VEditor” to the PHP error log; the model still works.

Streaming arrives all at once

A proxy buffers the response. With nginx, X-Accel-Buffering: no is sent automatically; with Apache and mod_php, mod_deflate is disabled for the response (with PHP-FPM disable compression for the AI endpoint yourself). A CDN or a PHP output buffer (output_buffering) can still buffer; disable it for the AI endpoint.

Chrome keeps old editor files

ES modules are cached aggressively. After an update without a versioned address, reload with Ctrl+Shift+R. The Laravel and Symfony integrations put the version in the address and Yii2 publishes the files under a new hash when the package changes, so this does not happen there.

Something unclear? Send feedback on the documentation.