Troubleshooting
Look at the console and Network first. When something is refused it always leaves a message; nothing fails silently.
Console messages
The runtime's messages are in Chinese (they come from the PHP project). Match them by their beginning:
| Message starts with | Meaning | Fix |
|---|---|---|
端點設定缺失 / 端點設定格式錯誤 (endpoint config missing / malformed) | The page lacks the endpoint meta, or <html> has no data-cg-endpoints | The layout needs <html{{ cg_html_attrs() }}> and {{ cg_head() }}; the web middleware needs share_head |
…被拒絕 —— 這個元素不在任何 data-render-blade-object 裡面 (refused, not inside any object) | No object on the ancestor chain | Wrap it with runtime::render_object |
…被拒絕 —— 物件 "X" 的 data-render-allow 只有 [...] (refused, object only allows …) | The action isn't granted | Displaying needs StateRead, writing StateWrite, rendering Render |
data-render-blade-object 需要名稱 (needs a name) | The value is an empty string | Give render_object a name |
data-render-allow 有不認得的動作 X (unknown action) | A typo in a hand-written attribute | Generate it with render_object, or write only render, state:read, state:write |
data-state-class 需要 "key:class" 格式 (needs key:class) | The colon is missing | data-state-class="advanced:is-open" |
data-state-init:JSON 格式錯誤 (bad JSON) | Starts with { but isn't valid JSON | Check the quotes, or use k=v; build values from Rust with serde_json |
…無法序列化,略過 (can't serialize, skipped) | The value contains a function, DOM node or circular reference | Store only JSON-serializable data |
renderBladeAuto:容器需要 id (container needs an id) | The render_auto container has no id | Add an id |
Network status codes
POST /{prefix}/render returns | Cause | Fix |
|---|---|---|
| 404 | Wrong prefix: the page and server have different APP_KEYs, or the page is old | Reload; with several servers, check that APP_KEY matches |
| 419 | The render token was already used or isn't in the session | Usually an expired session or a blocked cookie; reload. When calling the endpoint yourself, switch to the key from each response |
422 name: The selected name is invalid. | The name isn't registered | Check register() in src/cg/mod.rs for render::register(...), and data-render-name for typos |
422 params.x … | A param is too long or not a string | At most 2048 characters per param |
| 500 | The fragment function returned Err | Check the server log |
Clicking a button does nothing
- Is there a "被拒絕" (refused) in the console? → see the table above
- Is
data-cg-eventmisspelled (renderBladeis case-sensitive)? Generating it withrender_triggeravoids that - Is
resources/js/site.jsloaded ({{ vite("resources/js/site.js") }}in the layout)? - Was this HTML inserted with your own
innerHTML? → without going through render fragments it isn't rebound - Is Vite running / built?
The value was stored, but the page didn't change
- You changed a copy you got back:
s.get('o').x = 1doesn't notify; uses.merge('o', { x: 1 }). - Arrays too: use
s.update('list', (l = []) => l.concat(x)). - The display and the writer are in different namespaces. The same key under different objects is two different values.
- Linker's
datawasn't written: the nearest render object around the triggering element lacksStateWrite.
Text goes blank on load
data-state-text falls back to the text written in the template when the key has no value. If it really goes blank, usually:
- The template had no initial value → use
data-state-init="display=0" - Someone did
set(key, ''), which really sets an empty string - Linker returned
.data("x", None::<String>)→null
State disappeared after a re-render
- Did you press F5? A reload always resets it; that's the spec.
- Switched to another tab? Two tabs = two states.
- A full-page navigation?
pagehideclears it. Page-mode navigation does not clear it; if it disappears in that case, something really is wrong.
A fragment is never unchanged
- Does the fragment contain a Linker mount (
linker::mountattributes)? It produces a new uuid every time. Move the mount point outside. - Does it contain a time, a random value, a CSRF token or anything else that differs every time?
- Only
Componentsmode has fingerprints.
Endpoints return 404 after an upgrade
Check the path in the Network panel. If it's still the old one, reload so the page and JS get the same endpoint configuration; on multi-node deployments, check that APP_KEY matches.
bash
laravel route:listlists POST /{prefix}/render and the other routes. The real prefix is an HMAC of APP_KEY; in tests you can get it with cg_component::runtime::endpoints::prefix().