Diagnostics reference
Every Sneferu diagnostic code, SN1xxx to SN9xxx, with what triggers it and how to fix it.
On this page
Every problem Sneferu reports has a stable code. The format is file:line:col severity CODE message. Errors fail validate and build.
| Series | Stage |
|---|---|
| SN1xxx | lexing and parsing templates |
| SN2xxx | template validation (tags, attributes, safety) |
| SN3xxx | package, manifest and compile |
| SN4xxx | rendering |
| SN9xxx | artifact (IR) integrity check at load time |
SN1xxx Syntax
| Code | Meaning | Fix |
|---|---|---|
| SN1001 | {{ has no closing }} | Close the output expression. |
| SN1002 | {% has no closing %} | Close the directive. |
| SN1003 | Unterminated tag or attribute value | Close the quote or the >. |
| SN1004 | <hk-schema> has no closing </hk-schema> | Add the closing tag. |
| SN1101 | An element, {% if %} or {% for %} is never closed | Add the matching closing tag or {% endif %} / {% endfor %}. |
| SN1102 | {% elsif %} / {% else %} outside {% if %}, or {% endif %} / {% endfor %} without a matching opener | Check nesting of directives. |
| SN1103 | A closing tag closes a different element than the innermost open one | Close inner elements first. |
| SN1104 | A closing tag has no matching opening tag | Remove it or add the opener. |
| SN1105 | Invalid expression, for header or render argument | Check the grammar in language.md; for is x in expr [limit:n] (or limit: section.settings.x), render is 'name', key: expr. collection() takes a handle or a collection setting; collections() takes no arguments. |
| SN1106 | Unknown directive | Use if, elsif, else, endif, for, endfor, render. |
| SN1107 | <hk-schema> is not valid JSON | Fix the JSON (double quotes, no trailing commas). |
| SN1108 | Elements and {% if %} / {% for %} nested deeper than 64 levels; the deeper part is not compiled | Flatten the markup or move parts into snippets. |
| SN1109 | A second {% else %}, or {% elsif %} after {% else %} | Keep one {% else %}, last in the {% if %}. |
SN2xxx Template validation
| Code | Meaning | Fix |
|---|---|---|
| SN2001 | Element not on the allow-list (see language.md), for example script, style, iframe, form, SVG animate/set/foreignobject, form controls or custom elements | Remove it; put styles in assets/*.css; use hk-* tags. |
| SN2002 | Forbidden attribute (on* handlers, srcdoc, formaction, attributename, xml:base) or an invalid attribute name | Remove it. |
| SN2003 | Unknown hk-* tag | Check the spelling; the message suggests the closest tag. |
| SN2004 | Unknown property on a tag, or tablet- / mobile- on a prop that is not responsive | Use a declared prop; only responsive props take prefixes. |
| SN2005 | A required property is missing | Add the property. |
| SN2006 | The tag does not accept this child | Use an allowed child element. |
| SN2007 | Loop limit outside 1..250 | Use a limit between 1 and 250. |
| SN2008 | {% render %} names a snippet that does not exist | Create snippets/<name>.snf or fix the name. |
| SN2009 | style attribute contains {{ }} | Use a class, a token or a component prop. |
| SN2010 | Unsafe static URL in a URL attribute (href, any *:href such as xlink:href, src, poster, action, formaction) | Only https:, mailto:, tel: or relative URLs are allowed; plain http:, protocol-relative //… and anything containing \ are rejected. |
| SN2011 | <hk-slot> used outside a layout or template | Move it into the layout or a template. |
| SN2012 | collection(…), product(…), menu(…) or limit: reads a setting that does not exist in the file's <hk-schema> (or in theme.json for settings.*), or that has the wrong type | Add the setting, or fix its type: collection for collection(), product for product(), menu for menu(), number or range for limit:. |
| SN2013 | <hk-part> is not a direct child of a tag that has parts, or its name is missing, contains {{ }}, or is not one of the tag's parts | Put it directly inside the tag (for example <hk-product-card>, parts badge and actions) and use one of its part names. |
| SN2014 | An interactive tag (a, button, details, label, hk-button, hk-product-card, hk-product-grid, hk-rich-text) is inside <hk-part name="badge"> of <hk-product-card>; the badge renders inside the card's link. | Use plain markup in the badge, or move the interactive element to the actions part. |
| SN2015 | Warning: a literal <img> has no width and height attribute | Set both, so the page does not jump while the image loads (see Images and assets). hk-image sets them from its props. |
| SN2016 | Warning: a template reads an object of another page type (product outside product, collection or paginate outside collection and search, ...); a loop variable of the same name is fine | Move the markup to the right template, or to a section used there. See Page types. |
| SN2017 | <hk-section-group> has no fixed name, or the name is not header, footer or announcement | Write name="header" as plain text. |
| SN2018 | <hk-section-group> outside layout/theme.snf | Place groups in the layout. |
| SN2019 | The same group is placed twice in the layout | Place each group once. |
| SN2020 | An attribute value contains a {% %} directive, such as class="btn {% if x %}is-on{% endif %}". Directives work around elements, not inside an attribute, so it would otherwise render as stray class names | Print a value with {{ }}: class="btn btn-{{ block.settings.style }}" with a select setting. Or put the {% if %} around two versions of the element. |
| SN2021 | <hk-app-block> names an app and block that are not a pair on the platform's closed list of app blocks. | Use a pair the platform offers, or let the editor's section place it. There is no way to add your own address. |
SN3xxx Package, manifest and compile
| Code | Meaning | Fix |
|---|---|---|
| SN3001 | theme.json is missing | Add it at the theme root. |
| SN3002 | Invalid file path (absolute, .., bad characters, backslash, symlink) | Use lower-case names with letters, digits, ., _, -, and start every name with a letter or digit (a folder such as assets/_old/ is rejected). The message names the segment that failed. A symlink is refused by the CLI when it reads the folder: copy the file instead. |
| SN3003 | File type or location not allowed | Put files in the allowed folders with the allowed extensions. |
| SN3004 | Duplicate file | Remove the duplicate. |
| SN3005 | Too many files (max 400) | Remove unused files. |
| SN3006 | Package larger than 25 MB | Compress or remove assets. |
| SN3007 | An asset is larger than 2 MB | Compress or split it. |
| SN3008 | A template is larger than 300 KB | Split it into sections or snippets. |
| SN3009 | theme.json is not an object or not valid JSON | Fix the JSON. |
| SN3010 | engine is not "hk2" | Set "engine": "hk2". |
| SN3011 | engineCompatibility does not include the current engine | Use a range that includes 2.0.0, such as ^2.0.0. |
| SN3012 | Invalid id | 3-41 characters: lower-case letters, digits, dashes, starting with a letter. |
| SN3013 | name is missing or not a string | Write the theme name as a string. |
| SN3014 | version is not x.y.z | Use semantic versioning. |
| SN3015 | author is missing | Add it. |
| SN3016 | description is missing or not a string | Write a one-line description as a string. |
| SN3017 | category is missing | Add it. |
| SN3018 | defaultLocale is not en/ar, locales omits it, or lists another code | Fix defaultLocale and locales. |
| SN3019 | A required colour token is missing or not #RRGGBB | Set primary, secondary, accent, background, text. |
| SN3020 | A template references a section that does not exist | Create the section or fix the type. |
| SN3021 | settings in theme.json is not an object | Use an object of fields. |
| SN3022 | File is not valid UTF-8 | Re-save as UTF-8. |
| SN3023 | layout/theme.snf is missing | Add the layout. |
| SN3024 | templates/index.snf is missing | Add the index template. |
| SN3025 | A locale file is not valid JSON, or is not a flat object whose values are all strings | Use { "key": "text", ... } with string values only. |
| SN3027 | Snippet include cycle, e.g. snippet include cycle: a → b → a | Break the cycle; a snippet may not (indirectly) render itself. |
| SN3026 | A template's schema sections (or a section's blocks) is malformed | Use an array of { "type": "...", "settings": {...}, "blocks": [...] }. |
| SN3028 | A template's default section lists a block type that is not in blocks/ | Create the block or fix the type. |
| SN3029 | A default section (in a template or a group) lists a block its section or parent block does not allow, more than blocks.max, or blocks nested deeper than two levels | Add the type to the section's blocks.allowed, or list fewer blocks. |
| SN3030 | A section or block <hk-schema> lacks a name or has bad settings | Add a name string; settings must be an object. |
| SN3031 | A setting's label is not a string (warning) | Write the label as a string. |
| SN3032 | tokens.fonts is not an object, has a key other than heading, body, mono, or names a font that is not in the catalogue | Use one of the catalogue families exactly as written (see Fonts). |
| SN3033 | money in theme.json is not { "format": "decimal" } or { "format": "whole" } | Use one of the two formats, or remove money for the default. |
| SN3034 | Warning: an asset in assets/ is not served on the store (only images are): a .js, a font or an .ico | Remove it, or use tokens.fonts, hk-icon or inline SVG instead (see Images and assets). |
| SN3035 | A template is not named after a page type | Use index, product, collection, search, cart, page or 404; only product, collection and page take an alternate (product.codes). |
| SN3036 | A groups/<name>.json is not valid JSON, is not { "sections": [ … ] }, or is over 64 KB | Fix the file. See Section groups. |
| SN3037 | A group file lists a section that does not exist | Create the section or fix the type. |
| SN3038 | A group file entry is malformed: more than 12 sections, a bad or duplicate id, a bad block_order | Use ids of letters, digits, - and _; list only existing block ids in block_order. |
| SN3039 | Warning: a group file for a group the layout never places | Add <hk-section-group name="…" /> to the layout, or delete the file. |
| SN3040 | A section's templates list is empty, too long or names something that is not a page type, an alternate or a group | Use page types, product.<alt> or header, footer, announcement. |
| SN3041 | A default section sits where its templates list says it may not (in a template or a group) | Add the template or group to the list, or use another section. |
| SN3042 | blocks.allowed names a block that is not in blocks/ | Create the block or fix the name. |
| SN3043 | A file in sections/, blocks/ or snippets/ is named hk-…; that prefix is reserved for the default store's own sections, blocks and snippets | Rename the file (and every reference to it) without the hk- prefix. |
| SN3044 | One name in both forms in one folder, such as sections/hero.snf and sections/hero.sneferu | Keep one file; .snf is the current extension, .sneferu still works. |
| SN3045 | A migrations/*.json file is malformed: not JSON, unknown keys, bad names, a rename to itself, two names renamed to one, or a name both renamed and removed | Use { "from", "to", "settings"?, "sections"?, "blocks"? }, each with rename (old: new) and remove (list). |
| SN3046 | A migration's versions are wrong: from is not older than to, to is newer than the theme's version, two files cover the same step, or the steps form a cycle | Fix the versions; each file carries one step, with from < to <= version. |
| SN3047 | A migration renames to a setting, section or block the current theme does not have, or removes one it still has | Rename only to names that exist now; remove only what is gone. |
| SN3048 | settings in theme.json declares a setting with the id checkout; the store keeps the merchant's checkout branding under that key | Rename the setting. Brand the checkout with the top-level checkout block (see Checkout branding). |
| SN3049 | Warning: checkout in theme.json is not an object; it is ignored | Write "checkout": { … } with the checkout settings, or remove it. |
| SN3050 | Warning: checkout has a key that is not a checkout setting; it is dropped | Use color_accent, color_button, color_button_text, color_background, color_surface, color_border, color_text, font, radius, button_shape, logo, chrome or trust_note. |
| SN3051 | Warning: checkout.logo_image is set; the checkout logo image is the merchant's to upload, so it is dropped | Remove it. Set "logo": "store" to show the store's logo. |
| SN3052 | Warning: a checkout colour is not #rgb or #rrggbb; it is dropped | Write the colour as hex, such as #0f766e. |
| SN3053 | Warning: checkout.font is not "default" or a family in the font catalogue; it is dropped | Use "default" (the body font) or a catalogue family exactly as written (see Fonts). |
| SN3054 | Warning: checkout.radius is outside 0–24 or not a whole number (it is clamped and rounded), or is not a number (it is dropped) | Use a whole number of pixels from 0 to 24. |
| SN3055 | Warning: checkout.button_shape, logo or chrome is not one of its values; it is dropped | button_shape: square, rounded, pill. logo: store, custom, none. chrome: theme, minimal. |
| SN3056 | Warning: checkout.trust_note is not { "ar": text, "en": text }, or has another language or a non-text value; that part is dropped | Write plain text for ar and en. |
| SN3057 | Warning: a checkout.trust_note text is over 140 characters; it is cut to 140 | Shorten the note. |
| SN3059 | Warning: tokens.layout.contentWidth is not "full" or "<3-4 digits>px"; it is ignored | Use "full" or a width such as "1200px" |
| SN3058 | Warning: a key in tokens.colors is not lower-case letters, digits and dashes (for example sageSoft); it is not emitted as a --hk-color-* variable | Rename the key to kebab-case, such as sage-soft, and use var(--hk-color-sage-soft). |
SN4xxx Rendering
These are reported by the runtime while rendering a page. The page still renders; the affected part is dropped.
| Code | Meaning | Fix |
|---|---|---|
| SN4001 | Render budget exceeded (nodes, loop iterations or output size); the section degrades | Lower loop limits or simplify the section. |
| SN4002 | Snippet or block include depth exceeded (8); reported once per page | Remove recursive or deeply nested includes. |
| SN4003 | Maximum nesting depth (64) reached; reported once per page | Flatten the markup. |
| SN4004 | Snippet not found at render time | Create the snippet. |
| SN4005 | Component not available in the registry | Use a tag the platform provides. |
| SN4006 | A component failed while rendering | Check the props passed to it. |
| SN4010 | Template not found | Create templates/<name>.snf. |
| SN4011 | A page section's type does not exist in the theme, or the page section is malformed | Add the section or remove it from the page. |
| SN4012 | A block's type does not exist in the theme; the block is skipped | Add blocks/<type>.snf or remove the block. |
| SN4013 | A <hk-section-group> was reached outside the layout; it renders nothing (reported once per page) | Place section groups in layout/theme.snf only. |
| SN4014 | A section in a group (header, footer, announcement) has a templates list that does not name that group; the section is skipped | Add the group to the section's templates, or remove the section from the group. |
SN9xxx Artifact integrity
The runtime re-checks a compiled artifact before rendering. These indicate a corrupt or tampered artifact; rebuild it with sneferu build.
| Code | Meaning | Fix |
|---|---|---|
| SN9001 | Unknown IR node kind | Rebuild with the current SDK. |
| SN9002 | Unknown component in the IR | Rebuild; check the tag exists. |
| SN9003 | Unknown filter in the IR | Rebuild. |
| SN9004 | Loop limit in the IR is neither a whole number in 1..250 nor a section, block or theme setting path | Rebuild. |
| SN9005 | Invalid expression in the IR | Rebuild. |
| SN9006 | Unknown lookup in the IR | Rebuild. |
| SN9007 | Invalid property value in the IR | Rebuild. |
| SN9008 | Malformed IR structure (expected array or object) | Rebuild. |
| SN9009 | IR nested too deeply | Flatten the templates and rebuild. |
| SN9010 | An html node is not a string | Rebuild. |
| SN9011 | Element not on the allow-list in the IR | Rebuild; the element is not allowed. |
| SN9012 | Attribute not allowed in the IR (on*, srcdoc, formaction, attributename, xml:base, dynamic style) | Rebuild. |
| SN9013 | Invalid attribute sink, or a URL attribute (href, *:href, src, …) without the url sink | Rebuild. |
| SN9014 | A static HTML chunk does not match the compiler's output grammar (comment, <!…>, <?…>, CDATA, raw </> in text, unquoted or single-quoted value, markup inside <title>, tag left open, disallowed element) or has a bad attribute (on*, forbidden name, javascript:/vbscript:/data:text/html value, unsafe URL). The compiler also reports this for its own output, e.g. style="background:url(javascript:…)" | Rebuild; if it comes from sneferu build, remove the offending attribute value. |
| SN9015 | The artifact's structure is malformed (missing or wrong-typed manifest, sections, schemas, fields, …), or rendering failed unexpectedly; the page is not rendered | Rebuild with sneferu build; report the message if it persists. |
| SN9016 | A template, section, block or snippet in the artifact places <hk-section-group>; only the layout may. The artifact is rejected | Rebuild with sneferu build (the compiler reports SN2018). |
| SN9017 | A collection(), product() or menu() lookup in the artifact does not have exactly one argument that is a string or a setting path (section.settings.x, block.settings.x, settings.x). The artifact is rejected | Rebuild with sneferu build (the compiler reports SN1105). |
