EnglishSwitch to English
打开导航

错误码

v1.0.0-alpha.14 · 仓库基线 面共有 26 个 OEC 编译器诊断与 3 个运行时错误码。下表每一行都由触发它的源码渲染而成。

01 / 码表

错误码,以及它们被触发的位置。

OEC90xx 系列是编译器诊断:每个码对应一条编译元素边界强制执行的语法规则,每一行列出构建产生它的确切源码调用点。运行时错误码是应用可以分支处理的 ErrorCode 常量。码不可能只出现在源码里而不出现在这里。

OEC9000编译器语法

diagnosticMessage(…)

c/internal/compiler/semantic-core/compiler-diagnostics.ts:67
OEC9001编译器语法

expected exactly one @element(...) class per compiled module (the decorator must bind the canonical element import from '@openelement/element')

c/internal/compiler/semantic-core/analyze-module.ts:793
OEC9002编译器语法

@element option "…" may appear only once

9 条不同消息: @element option "…" may appear only once · @element options must be an object literal · @element options must be named literal assignments · @element options support only root, delegatesFocus and formAssociated · @element requires a string tag name plus an optional options object · @element root "…" is unsupported; use "light", "shadow-open" or "shadow-closed" · @element root must be a string literal · @element tag "…" is not a custom-element name · @element … must be a boolean literal

c/internal/compiler/semantic-core/analyze-module.ts:840 · c/internal/compiler/semantic-core/analyze-module.ts:846 · c/internal/compiler/semantic-core/analyze-module.ts:860 · c/internal/compiler/semantic-core/analyze-module.ts:865 · c/internal/compiler/semantic-core/analyze-module.ts:869 · c/internal/compiler/semantic-core/analyze-module.ts:874 · c/internal/compiler/semantic-core/analyze-module.ts:880 · c/internal/compiler/semantic-core/analyze-module.ts:892 · c/internal/compiler/semantic-core/analyze-module.ts:901
OEC9003编译器语法

compiled classes must be named

2 条不同消息: compiled classes must be named · compiled classes must extend a canonical import of OpenElement or ErrorBoundary from '@openelement/element' (found ……)

c/internal/compiler/semantic-core/analyze-module.ts:921 · c/internal/compiler/semantic-core/analyze-module.ts:930
OEC9004编译器语法

compiled OpenElement classes must carry exactly one @element decorator

6 条不同消息: compiled OpenElement classes must carry exactly one @element decorator · method parameters may not carry decorators in the compiler grammar · methods may not carry decorators in the compiler grammar · unknown decorator on an OpenElement class; use only @element · unknown decorator on an OpenElement member; use only @property · unknown decorator on an OpenElement member; use only @property imported from '@openelement/element'

c/internal/compiler/semantic-core/analyze-module.ts:433 · c/internal/compiler/semantic-core/analyze-module.ts:448 · c/internal/compiler/semantic-core/analyze-module.ts:603 · c/internal/compiler/semantic-core/analyze-module.ts:608 · c/internal/compiler/semantic-core/analyze-module.ts:803 · c/internal/compiler/semantic-core/analyze-module.ts:831
OEC9005编译器语法

@property reflect must be a boolean literal

9 条不同消息: @property reflect must be a boolean literal · @property requires one options object literal · compiled @property fields must be ordinary initialized instance fields · compiled classes may declare static styles only once · compiled fields must carry exactly one @property decorator · compiled fields require a literal initializer · duplicate property "…" · property names must be identifiers · static styles requires an initializer

c/internal/compiler/semantic-core/analyze-module.ts:387 · c/internal/compiler/semantic-core/analyze-module.ts:390 · c/internal/compiler/semantic-core/analyze-module.ts:420 · c/internal/compiler/semantic-core/analyze-module.ts:426 · c/internal/compiler/semantic-core/analyze-module.ts:454 · c/internal/compiler/semantic-core/analyze-module.ts:457 · c/internal/compiler/semantic-core/analyze-module.ts:461 · c/internal/compiler/semantic-core/analyze-module.ts:484 · c/internal/compiler/semantic-core/analyze-module.ts:507
OEC9006编译器语法

compiled @element classes must be exported (optionally as the default export) without other class modifiers

4 条不同消息: compiled @element classes must be exported (optionally as the default export) without other class modifiers · compiled methods must be concrete instance methods · constructors, accessors and undecorated fields are outside the compiler grammar · method names must be identifiers

c/internal/compiler/semantic-core/analyze-module.ts:600 · c/internal/compiler/semantic-core/analyze-module.ts:613 · c/internal/compiler/semantic-core/analyze-module.ts:633 · c/internal/compiler/semantic-core/analyze-module.ts:820
OEC9007编译器语法

compiled classes may declare only one render() method

6 条不同消息: compiled classes may declare only one render() method · compiled classes must declare render() · render() must be a single return of one JSX element · render() must be a synchronous zero-argument method · render() must return a single JSX element · render() must return one intrinsic JSX element

c/internal/compiler/semantic-core/analyze-module.ts:617 · c/internal/compiler/semantic-core/analyze-module.ts:623 · c/internal/compiler/semantic-core/analyze-module.ts:637 · c/internal/compiler/semantic-core/compile.ts:134 · c/internal/compiler/semantic-core/compile.ts:139 · c/internal/compiler/semantic-core/lower-program.ts:381
OEC9008编译器语法

runtime top-level statements are outside the compiled module grammar

c/internal/compiler/semantic-core/analyze-module.ts:763
OEC9010编译器语法

component tag <…> is outside the compiler grammar (intrinsic lowercase elements and custom-element hosts only) — custom elements compose by tag name — use the tag string, not the class value

4 条不同消息: component tag <…> is outside the compiler grammar (intrinsic lowercase elements and custom-element hosts only) — custom elements compose by tag name — use the tag string, not the class value · itemTagReason · list Region item must be an intrinsic lowercase element · tagReason

c/internal/compiler/semantic-core/lower-program.ts:409 · c/internal/compiler/semantic-core/lower-program.ts:414 · c/internal/compiler/semantic-core/lower-program.ts:1094 · c/internal/compiler/semantic-core/lower-program.ts:1097
OEC9011编译器语法

attribute name "…" is unsafe

16 条不同消息: attribute "…" must be a literal or a supported expression · attribute "…" must be a literal, this.<property>, or a supported expression · attribute "…" only accepts primitive literal values · attribute name "…" is unsafe · conditional class branches must be string literals: class={this.<cond> ? 'a' : 'b'} · conditional class conditions must read at least one this.<property> · duplicate attribute "…" is unsupported · item template attribute "…" must be a static literal or {….<field>} · item template attributes must be static literals · item template attributes must use primitive literals · key is only supported on the list Region item root · list Region items do not support spread attributes · property sink name "…" is unsafe · ref must reference this.<field> · spread attributes are not supported by the compiler grammar · spread attributes are not supported in item templates

c/internal/compiler/semantic-core/lower-program.ts:432 · c/internal/compiler/semantic-core/lower-program.ts:446 · c/internal/compiler/semantic-core/lower-program.ts:460 · c/internal/compiler/semantic-core/lower-program.ts:464 · c/internal/compiler/semantic-core/lower-program.ts:478 · c/internal/compiler/semantic-core/lower-program.ts:494 · c/internal/compiler/semantic-core/lower-program.ts:531 · c/internal/compiler/semantic-core/lower-program.ts:543 · c/internal/compiler/semantic-core/lower-program.ts:549 · c/internal/compiler/semantic-core/lower-program.ts:767 · c/internal/compiler/semantic-core/lower-program.ts:787 · c/internal/compiler/semantic-core/lower-program.ts:865 · c/internal/compiler/semantic-core/lower-program.ts:872 · c/internal/compiler/semantic-core/lower-program.ts:878 · c/internal/compiler/semantic-core/lower-program.ts:1016 · c/internal/compiler/semantic-core/lower-program.ts:1104 · c/internal/compiler/semantic-core/lower-program.ts:1109 · c/internal/compiler/semantic-core/lower-program.ts:1123 · c/internal/compiler/semantic-core/lower-program.ts:1127 · c/internal/compiler/semantic-core/lower-program.ts:1139 · c/internal/compiler/semantic-core/lower-program.ts:1184 · c/internal/compiler/semantic-core/lower-program.ts:1190
OEC9012编译器语法

Region branches must be fully static

4 条不同消息: Region branches must be fully static · conditional Region branches must be single static JSX elements · event handlers are only supported on list Region item templates · nested Regions are outside the compiler grammar

c/internal/compiler/semantic-core/lower-program.ts:484 · c/internal/compiler/semantic-core/lower-program.ts:492 · c/internal/compiler/semantic-core/lower-program.ts:508 · c/internal/compiler/semantic-core/lower-program.ts:892 · c/internal/compiler/semantic-core/lower-program.ts:907 · c/internal/compiler/semantic-core/lower-program.ts:921 · c/internal/compiler/semantic-core/lower-program.ts:982 · c/internal/compiler/semantic-core/lower-program.ts:1153
OEC9013编译器语法

list Region mapper must return one JSX element

12 条不同消息: JSX fragments and spreads are outside the compiler grammar · conditional Regions support this.<property> compared with a numeric literal (>, >=, <, <=), a number/string/boolean equality (===, !==), or a bare this.<property> (optionally negated) truthiness test · dynamic child literals must be primitive values · item child must be {….<field>} · item templates support static text, item values and intrinsic elements · list Region items must bind at least one {<item>.<field>} value or attribute slot · list Region mapper must be a single-parameter arrow function · list Region mapper must return one JSX element · list Regions must map over this.<property> · list Regions support exactly this.<property>.map(...) · unsupported dynamic expression; use this.<property>, a supported condition, or this.<array>.map(...) · void element <…> may not have children

c/internal/compiler/semantic-core/lower-program.ts:609 · c/internal/compiler/semantic-core/lower-program.ts:614 · c/internal/compiler/semantic-core/lower-program.ts:900 · c/internal/compiler/semantic-core/lower-program.ts:927 · c/internal/compiler/semantic-core/lower-program.ts:961 · c/internal/compiler/semantic-core/lower-program.ts:992 · c/internal/compiler/semantic-core/lower-program.ts:995 · c/internal/compiler/semantic-core/lower-program.ts:1002 · c/internal/compiler/semantic-core/lower-program.ts:1005 · c/internal/compiler/semantic-core/lower-program.ts:1009 · c/internal/compiler/semantic-core/lower-program.ts:1053 · c/internal/compiler/semantic-core/lower-program.ts:1199 · c/internal/compiler/semantic-core/lower-program.ts:1228 · c/internal/compiler/semantic-core/lower-program.ts:1252
OEC9014编译器语法

key must be key={<item>.<field>}

4 条不同消息: key must be key={<item>.<field>} · key must reference ….<field> · list Region items may declare key only once · list Region items require key={<item>.<field>}

c/internal/compiler/semantic-core/lower-program.ts:1019 · c/internal/compiler/semantic-core/lower-program.ts:1025 · c/internal/compiler/semantic-core/lower-program.ts:1036 · c/internal/compiler/semantic-core/lower-program.ts:1039
OEC9015编译器语法

… part path […] is preceded by a dynamic anchor; path-addressed fixed sinks must appear before any dynamic anchor sibling

c/internal/compiler/semantic-core/emit-program.ts:39
OEC9016编译器语法

event arithmetic supports only numeric += or -= literals

6 条不同消息: event arithmetic supports only numeric += or -= literals · event arrow handlers must contain exactly one supported action · event assignment values must be serializable literals · event handlers must be this.<method> or a single-action arrow · event mutations support only this.<number>++ or -- · unsupported event action; use this.<field>++, assignment or this.<method>()

c/internal/compiler/semantic-core/lower-program.ts:651 · c/internal/compiler/semantic-core/lower-program.ts:663 · c/internal/compiler/semantic-core/lower-program.ts:694 · c/internal/compiler/semantic-core/lower-program.ts:706 · c/internal/compiler/semantic-core/lower-program.ts:723 · c/internal/compiler/semantic-core/lower-program.ts:731
OEC9017编译器语法

custom-element host <…> may not carry event handlers

3 条不同消息: custom-element host <…> may not carry a ref · custom-element host <…> may not carry event handlers · custom-element host <…> may not have children in the compiler grammar (slots are unsupported)

c/internal/compiler/semantic-core/lower-program.ts:443 · c/internal/compiler/semantic-core/lower-program.ts:490 · c/internal/compiler/semantic-core/lower-program.ts:1148 · c/internal/compiler/semantic-core/lower-program.ts:1204
OEC9020编译器语法

property defaults must be serializable literals

c/internal/compiler/semantic-core/analyze-module.ts:480
OEC9021编译器语法

property type/converter must be one of String, Number, Boolean, Array or Object

c/internal/compiler/semantic-core/analyze-module.ts:166
OEC9022编译器语法

@property option "…" may appear only once

3 条不同消息: @property option "…" may appear only once · @property options must be named literal assignments · unsupported @property option "…"

c/internal/compiler/semantic-core/analyze-module.ts:495 · c/internal/compiler/semantic-core/analyze-module.ts:499 · c/internal/compiler/semantic-core/analyze-module.ts:531
OEC9023编译器语法

a property with attribute: false cannot reflect

4 条不同消息: a property with attribute: false cannot reflect · duplicate property attribute "…" · property attribute must be a string literal or false · property attribute name is unsafe

c/internal/compiler/semantic-core/analyze-module.ts:518 · c/internal/compiler/semantic-core/analyze-module.ts:521 · c/internal/compiler/semantic-core/analyze-module.ts:558 · c/internal/compiler/semantic-core/analyze-module.ts:563
OEC9024编译器语法

computed field arrows may not declare parameters

9 条不同消息: computed field arrows may not declare parameters · computed field arrows use an expression body, not a block · computed field arrows use an expression body, not a block (keep derived values atomic) · computed fields take exactly one zero-argument arrow function · event actions may not write computed field "…" — assign its source properties · … may not nest non-arrow functions · … may not read computed field "…" · … may only read this.<declared property> (found this.…) · … may only reference this.<property>

c/internal/compiler/semantic-core/analyze-module.ts:215 · c/internal/compiler/semantic-core/analyze-module.ts:220 · c/internal/compiler/semantic-core/analyze-module.ts:225 · c/internal/compiler/semantic-core/analyze-module.ts:234 · c/internal/compiler/semantic-core/analyze-module.ts:287 · c/internal/compiler/semantic-core/analyze-module.ts:291 · c/internal/compiler/semantic-core/analyze-module.ts:302 · c/internal/compiler/semantic-core/analyze-module.ts:306 · c/internal/compiler/semantic-core/lower-program.ts:682
OEC9025编译器语法

computed fields require @property({ reflect: false, attribute: false }) — derived signals have no attribute channel

2 条不同消息: computed fields require @property({ reflect: false, attribute: false }) — derived signals have no attribute channel · computed fields require the canonical computed import: a runtime named import of computed from '@openelement/element'…

c/internal/compiler/semantic-core/analyze-module.ts:278 · c/internal/compiler/semantic-core/analyze-module.ts:549
OEC9026编译器语法

an innerHTML sink target must be otherwise childless (the sink owns its content)

8 条不同消息: an innerHTML sink target must be otherwise childless (the sink owns its content) · innerHTML sinks require an Object-typed TrustedHtml property · innerHTML sinks require the explicit trustedHtml capability marker · trustedHtml capability marker must be the literal true · trustedHtml capability marker requires an innerHTML sink · trustedHtml field defaults require the canonical trustedHtml import: a runtime named import of trustedHtml from '@openelement/element'… · trustedHtml field defaults require type: Object, reflect: false, and attribute: false · void element <…> cannot carry an innerHTML sink

c/internal/compiler/semantic-core/analyze-module.ts:129 · c/internal/compiler/semantic-core/analyze-module.ts:540 · c/internal/compiler/semantic-core/lower-program.ts:427 · c/internal/compiler/semantic-core/lower-program.ts:562 · c/internal/compiler/semantic-core/lower-program.ts:571 · c/internal/compiler/semantic-core/lower-program.ts:846 · c/internal/compiler/semantic-core/lower-program.ts:853 · c/internal/compiler/semantic-core/lower-program.ts:858
OEC9027编译器语法

unsupported @element provenance: …

2 条不同消息: unsupported @element provenance: … · unsupported @property provenance: …

c/internal/compiler/semantic-core/analyze-module.ts:442 · c/internal/compiler/semantic-core/analyze-module.ts:787
OEC9029编译器语法

duplicate sheet import binding "…" — a compiled module's .css imports bind distinct names so static styles can array them individually

3 条不同消息: duplicate sheet import binding "…" — a compiled module's .css imports bind distinct names so static styles can array them individually · the .css import "…" ("…") is never arrayed in static styles — every sheet import of a compiled module is adopted by its class · … — write the sheet to a .css file, import it (`import sheet from './<component>.css'`) and array the binding in static styles; inline sheet strings are retired (#1558)

c/internal/compiler/semantic-core/style-imports.ts:39 · c/internal/compiler/semantic-core/style-imports.ts:99 · c/internal/compiler/semantic-core/style-imports.ts:165
BOUNDARY_CAUGHT运行时

BOUNDARY_CAUGHT
SSR_RENDER_ERROR运行时

SSR_RENDER_ERROR
UNKNOWN运行时

UNKNOWN

摘要取该码触发次数最多的消息;调用点消息不唯一时会展开完整列表。源码路径均为仓库相对路径。

由 pnpm --dir www run check:error-codes 从诊断生成,因此新码无法不登记,退役的码也无法留在表上。