# 12. Troubleshooting

REST status codes and the save contract are in [REST API 10.9](10-rest-api.md#109-error-codes); this table is by symptom.

## 12.1 Saving and publishing

| Symptom / code | Cause | Fix |
|---|---|---|
| `jikji_invalid_markup` | A structure rule ([Syntax 8.7](08-syntax.md#87-what-a-save-refuses)) | Fix the elements in `data.errors`; `wp jikji content validate` first |
| `jikji_syntax_error` | Brackets or quotes in an expression | Fix `data.attr` of `data.id`; make sure the shell did not eat `$post` |
| `jikji_class_exists` | An existing global class was sent again (`wp jikji`, REST `existingClasses: "refuse"`) | Drop the row to only use the class; `--update-classes` / `baseCss` to change it |
| `jikji_class_conflict` | The `baseCss` you sent is not the current class | Read the class again |
| `jikji_conflict` | Someone saved while you were editing | `content get` again, reapply, save with the new `hash` |
| `jikji_css_dropped` | `--strict-css` and a declaration would be dropped | Fix the properties in `data.dropped` or move them to the theme CSS ([Styles 4.5](04-styles.md#45-what-css-is-accepted)) |
| Warning "These CSS declarations were dropped" | An unsupported property or a dangerous value | The same list is in `cssDropped`; the save went through |
| Warning "… refers to #…, which repeats in a loop" | An ID reference from outside the loop | Move the reference into the item ([Dynamic data 5.5](05-dynamic-data.md#55-loops)) |
| `jikji_compile_failed` (`data.saved: true`) | Saved, but the compile failed — the previous published version stays live | Fix and save again; the builder shows the error in its footer and offers *Retry publish* |
| Saved, but the page looks the same | A draft (page `draft`, template Jikji draft) or a page cache | `wp jikji status`; purge the cache |
| A deleted page left files in `wp-content/jikji/` | Compiled output and ID style rows outlive the post; templates and parts are purged on release/delete | Remove `wp-content/jikji/{css,templates}/<id>.*` if needed |
| `jikji_confirmation_required` | A site-wide change outside a terminal | Confirm with a person, then `--yes` |
| `jikji_no_admin` | No administrator with `jikji_compile` to run as | `--user=<login>` |
| `jikji_partial_failure` | `template create` / `assign` partly done | Run the command in `data.resume` |

## 12.2 Rendering and data

| Symptom / code | Cause | Fix |
|---|---|---|
| A whole loop is missing | The source is an empty array (invalid JSON included) | `wp jikji eval <id> "<source>" --mode=each` |
| JavaScript cannot find a looped element | Its ID has a per-item suffix (`--1`) | Select by class or `data-*` ([Dynamic data 5.9](05-dynamic-data.md#59-interaction-javascript)) |
| No sample on the canvas for a binding | The `j:*` is inside Rich Text markup | Move the binding to a block element |
| An icon does not show | Its icon set is disabled | Appearance → Jikji → General → Icon sets |
| `jikji_eval_errors` · `jikji_eval_incomplete` | An expression error / the time budget | Read `data.results`; make slow queries smaller |
| Theme CSS beats a Jikji style | A more specific theme selector | Jikji loads after the theme, so equal specificity wins; lower the theme selector or use an ID style ([Styles 4.7](04-styles.md#47-how-jikji-css-meets-the-theme)) |

## 12.3 Templates

| Symptom / code | Cause | Fix |
|---|---|---|
| `jikji_not_block_theme` | A classic theme | Templates, parts and patterns need a block theme |
| `jikji_not_found` (adopt) | The theme has no such template | `wp jikji template prepare <slug> --yes` |
| `jikji_hierarchy_slug` | `template create` with a hierarchy name | Adopt if it exists, prepare if not; a layout for several pages gets a non-hierarchy name ([Templates 6.5](06-templates.md#65-which-template-to-use)) |
| `jikji_not_hierarchy` | `template prepare` with a non-hierarchy name | `template create` |
| `jikji_not_managed` | Publishing or sampling a theme-file template before adopting it | `template adopt <slug>` |
| The template is not applied | A more specific template wins in the hierarchy, or another theme is active | `templates list`; adopt the name that matches the request |
| Pages and posts render as a list | A list layout was published to `index` and the theme has no `page`/`single` | Use a narrower name (`archive`, `home`) or prepare `page` and `single` |
| "Runtime error — block template shown" | A published template threw at runtime | Fix and publish again (clears it) or unpublish |
| The Site Editor shows no "Edit with Jikji" | Not a builder (`jikji_compile`), or an unsynced pattern | Only builders get the action; make the pattern synced |
| "Save and edit with Jikji" instead of adopting | The Site Editor has unsaved changes | Save first (the action does both); a failed save adopts nothing |
| "Jikji started from an empty skeleton" | The saved blocks could not be converted (`import.error`) | Build the document in the builder, or `content import` after fixing the blocks |

## 12.4 The AI tab

| Symptom / code | Cause | Fix |
|---|---|---|
| "AI editing needs WordPress 7.0 or newer" | No core AI Client | Upgrade WordPress (everything else works on 6.9) |
| "No AI provider is connected" | No provider key under Settings → Connectors, or the provider plugin is off | Add the key, activate the plugin; the answer is cached 5 minutes — *Check again* |
| "The AI model … is not available" | The chosen model disappeared or the provider is disconnected | Pick another model under Appearance → Jikji → AI; nothing is substituted automatically |
| `jikji_ai_rate_limited` · "Too many requests; try again in N s" | Calls per minute per user (60 by default; one request is 3–6 calls) | Wait, or raise the limit |
| `jikji_ai_budget` · "Today's token budget is used up" | Tokens per day per user | Resets at the site's midnight; raise the limit |
| `jikji_ai_provider_auth` | The provider refused the key | Check the key under Connectors |
| `jikji_ai_length` · "ran out of output tokens" | The output-token cap. The provider plugins (Anthropic 1.0.5+, OpenAI 1.2.0+) raise an error at the cap instead of returning a truncated result, so none of that call's changes are applied | Ask for a smaller change, or raise *output tokens per turn* (switching limits off uses the maximum, 65,536) |
| "Writing code and blocks is not enabled in Appearance → Jikji → AI." (tool result) | The code setting is off (or was switched off mid-turn) | **AI may write code and blocks** |
| "Writing code was switched off in Settings; the turn was discarded." | The setting was off when you pressed Apply | Switch it on and ask again |
| `jikji_ai_fetch_disabled` | External resources are off | **AI may fetch external resources** |
| `jikji_ai_fetch_url` · "private, local or reserved address" / "does not resolve" / "does not allow" | The host resolves to a private address, does not resolve, or the site policy filter refused it | Use a public host; the policy is `jikji_ai_fetch_allowed` |
| `jikji_ai_fetch_redirect` · "redirects to another host" | A cross-host redirect (3 hops, same host only) | Ask for the final URL directly |
| `jikji_ai_fetch_unavailable` · "through a proxy" | The site sends HTTP through a proxy | The `jikji_ai_fetch_transport` filter ([The AI tab 7.3](07-ai.md#73-code-and-blocks-external-resources-limits)) |
| `jikji_ai_fetch_rate_limited` | Fetches per user per minute (30) | Wait; not applied when limits are off |
| "The user did not allow this request." (tool result) | You denied the approval prompt (or pressed Stop) | If the request was intended, type the URL yourself and ask again |
