[{"data":1,"prerenderedAt":1045},["ShallowReactive",2],{"content-\u002Fdocs\u002Freference\u002Ferrors":3},{"id":4,"title":5,"body":6,"description":1025,"extension":1026,"meta":1027,"metaRows":1028,"navigation":103,"path":1040,"seo":1041,"source":1042,"stem":1043,"__hash__":1044},"docs\u002Fdocs\u002Freference\u002Ferrors.md","Errors reference",{"type":7,"value":8,"toc":1007},"minimark",[9,13,28,31,57,62,69,207,210,336,340,346,349,370,376,391,397,410,416,427,433,440,446,463,469,478,484,491,518,529,535,551,600,744,747,753,763,849,886,897,901,960,963,967,1003],[10,11,5],"h1",{"id":12},"errors-reference",[14,15,16],"blockquote",{},[17,18,19,20,23,24,27],"p",{},"Every Attaform-emitted error class with the failure mode it represents, plus the small set of stable ",[21,22,21],"code",{}," identifiers for ",[21,25,26],{},"ValidationError"," entries Attaform produces.",[29,30],"docs-meta-table",{},[17,32,33,34,37,38,41,42,45,46,49,50,49,53,56],{},"This page is reference material. Two surfaces: throw-class errors (caught with ",[21,35,36],{},"instanceof",") and ",[21,39,40],{},"ValidationError.code"," strings (matched in template \u002F handler logic). Both follow the ",[21,43,44],{},"atta:"," prefix convention for Attaform-emitted entries; consumer codes use whatever prefix you pick (",[21,47,48],{},"api:",", ",[21,51,52],{},"auth:",[21,54,55],{},"myapp:",").",[58,59,61],"h2",{"id":60},"catching-errors-polymorphically","Catching errors polymorphically",[17,63,64,65,68],{},"Every Attaform-emitted throw extends ",[21,66,67],{},"AttaformError",", so a single polymorphic catch works:",[70,71,76],"pre",{"className":72,"code":73,"language":74,"meta":75,"style":75},"language-ts shiki shiki-themes github-light github-dark","import { AttaformError } from 'attaform'\n\ntry {\n  \u002F\u002F useForm setup, register call, persist call, etc.\n} catch (err) {\n  if (err instanceof AttaformError) {\n    \u002F\u002F It's one of ours; log and handle.\n    console.error('[attaform]', err.name, err.message)\n  } else {\n    throw err\n  }\n}\n","ts","",[21,77,78,98,105,114,121,133,151,157,175,186,195,201],{"__ignoreMap":75},[79,80,83,87,91,94],"span",{"class":81,"line":82},"line",1,[79,84,86],{"class":85},"szBVR","import",[79,88,90],{"class":89},"sVt8B"," { AttaformError } ",[79,92,93],{"class":85},"from",[79,95,97],{"class":96},"sZZnC"," 'attaform'\n",[79,99,101],{"class":81,"line":100},2,[79,102,104],{"emptyLinePlaceholder":103},true,"\n",[79,106,108,111],{"class":81,"line":107},3,[79,109,110],{"class":85},"try",[79,112,113],{"class":89}," {\n",[79,115,117],{"class":81,"line":116},4,[79,118,120],{"class":119},"sJ8bj","  \u002F\u002F useForm setup, register call, persist call, etc.\n",[79,122,124,127,130],{"class":81,"line":123},5,[79,125,126],{"class":89},"} ",[79,128,129],{"class":85},"catch",[79,131,132],{"class":89}," (err) {\n",[79,134,136,139,142,144,148],{"class":81,"line":135},6,[79,137,138],{"class":85},"  if",[79,140,141],{"class":89}," (err ",[79,143,36],{"class":85},[79,145,147],{"class":146},"sScJk"," AttaformError",[79,149,150],{"class":89},") {\n",[79,152,154],{"class":81,"line":153},7,[79,155,156],{"class":119},"    \u002F\u002F It's one of ours; log and handle.\n",[79,158,160,163,166,169,172],{"class":81,"line":159},8,[79,161,162],{"class":89},"    console.",[79,164,165],{"class":146},"error",[79,167,168],{"class":89},"(",[79,170,171],{"class":96},"'[attaform]'",[79,173,174],{"class":89},", err.name, err.message)\n",[79,176,178,181,184],{"class":81,"line":177},9,[79,179,180],{"class":89},"  } ",[79,182,183],{"class":85},"else",[79,185,113],{"class":89},[79,187,189,192],{"class":81,"line":188},10,[79,190,191],{"class":85},"    throw",[79,193,194],{"class":89}," err\n",[79,196,198],{"class":81,"line":197},11,[79,199,200],{"class":89},"  }\n",[79,202,204],{"class":81,"line":203},12,[79,205,206],{"class":89},"}\n",[17,208,209],{},"Branch on the subclass for targeted handling:",[70,211,213],{"className":72,"code":212,"language":74,"meta":75,"style":75},"import { AttaformError, OutsideSetupError, AnonPersistError } from 'attaform'\n\ntry {\n  \u002F\u002F …\n} catch (err) {\n  if (err instanceof OutsideSetupError) {\n    \u002F\u002F Move the call into a Vue setup function\n  } else if (err instanceof AnonPersistError) {\n    \u002F\u002F Pass a stable `key` so persistence has a deterministic prefix\n  } else if (err instanceof AttaformError) {\n    \u002F\u002F Catch-all\n  } else {\n    throw err\n  }\n}\n",[21,214,215,226,230,236,241,249,262,267,285,290,306,311,319,326,331],{"__ignoreMap":75},[79,216,217,219,222,224],{"class":81,"line":82},[79,218,86],{"class":85},[79,220,221],{"class":89}," { AttaformError, OutsideSetupError, AnonPersistError } ",[79,223,93],{"class":85},[79,225,97],{"class":96},[79,227,228],{"class":81,"line":100},[79,229,104],{"emptyLinePlaceholder":103},[79,231,232,234],{"class":81,"line":107},[79,233,110],{"class":85},[79,235,113],{"class":89},[79,237,238],{"class":81,"line":116},[79,239,240],{"class":119},"  \u002F\u002F …\n",[79,242,243,245,247],{"class":81,"line":123},[79,244,126],{"class":89},[79,246,129],{"class":85},[79,248,132],{"class":89},[79,250,251,253,255,257,260],{"class":81,"line":135},[79,252,138],{"class":85},[79,254,141],{"class":89},[79,256,36],{"class":85},[79,258,259],{"class":146}," OutsideSetupError",[79,261,150],{"class":89},[79,263,264],{"class":81,"line":153},[79,265,266],{"class":119},"    \u002F\u002F Move the call into a Vue setup function\n",[79,268,269,271,273,276,278,280,283],{"class":81,"line":159},[79,270,180],{"class":89},[79,272,183],{"class":85},[79,274,275],{"class":85}," if",[79,277,141],{"class":89},[79,279,36],{"class":85},[79,281,282],{"class":146}," AnonPersistError",[79,284,150],{"class":89},[79,286,287],{"class":81,"line":177},[79,288,289],{"class":119},"    \u002F\u002F Pass a stable `key` so persistence has a deterministic prefix\n",[79,291,292,294,296,298,300,302,304],{"class":81,"line":188},[79,293,180],{"class":89},[79,295,183],{"class":85},[79,297,275],{"class":85},[79,299,141],{"class":89},[79,301,36],{"class":85},[79,303,147],{"class":146},[79,305,150],{"class":89},[79,307,308],{"class":81,"line":197},[79,309,310],{"class":119},"    \u002F\u002F Catch-all\n",[79,312,313,315,317],{"class":81,"line":203},[79,314,180],{"class":89},[79,316,183],{"class":85},[79,318,113],{"class":89},[79,320,322,324],{"class":81,"line":321},13,[79,323,191],{"class":85},[79,325,194],{"class":89},[79,327,329],{"class":81,"line":328},14,[79,330,200],{"class":89},[79,332,334],{"class":81,"line":333},15,[79,335,206],{"class":89},[58,337,339],{"id":338},"error-classes","Error classes",[341,342,344],"h3",{"id":343},"attaformerror",[21,345,67],{},[17,347,348],{},"Base class; never thrown directly, only via subclasses. Provides the polymorphic-catch entry point.",[70,350,352],{"className":72,"code":351,"language":74,"meta":75,"style":75},"class AttaformError extends Error {}\n",[21,353,354],{"__ignoreMap":75},[79,355,356,359,361,364,367],{"class":81,"line":82},[79,357,358],{"class":85},"class",[79,360,147],{"class":146},[79,362,363],{"class":85}," extends",[79,365,366],{"class":146}," Error",[79,368,369],{"class":89}," {}\n",[341,371,373],{"id":372},"invalidpatherror",[21,374,375],{},"InvalidPathError",[17,377,378,379,382,383,386,387,390],{},"A path string can't be canonicalized against the form's schema. Typical cause: a typo in ",[21,380,381],{},"register('parh')"," or ",[21,384,385],{},"setValue('a.bb.c')"," against a schema with no ",[21,388,389],{},".bb",".",[341,392,394],{"id":393},"invaliduseformconfigerror",[21,395,396],{},"InvalidUseFormConfigError",[17,398,399,402,403,406,407,56],{},[21,400,401],{},"useForm"," received an invalid configuration, most often a schema passed directly instead of inside an options object (",[21,404,405],{},"useForm(schema)"," rather than ",[21,408,409],{},"useForm({ schema })",[341,411,413],{"id":412},"submiterrorhandlererror",[21,414,415],{},"SubmitErrorHandlerError",[17,417,418,419,422,423,426],{},"The ",[21,420,421],{},"onError"," callback passed to ",[21,424,425],{},"handleSubmit"," threw. Caught and re-thrown wrapped in this class so the wrapping submit lifecycle can distinguish \"user error handler crashed\" from \"validation failed.\"",[341,428,430],{"id":429},"registrynotinstallederror",[21,431,432],{},"RegistryNotInstalledError",[17,434,435,436,439],{},"An Attaform API needs the registry attached to a Vue app, but it isn't installed. Auto-install kicks in for the lazy bootstrap path, so this usually means ",[21,437,438],{},"useRegistry()"," was called from outside a Vue app's lifecycle.",[341,441,443],{"id":442},"outsidesetuperror",[21,444,445],{},"OutsideSetupError",[17,447,448,450,451,454,455,458,459,462],{},[21,449,401],{}," \u002F ",[21,452,453],{},"injectForm"," \u002F similar composable called outside Vue setup. Move the call inside a ",[21,456,457],{},"setup()"," function or ",[21,460,461],{},"\u003Cscript setup>"," block.",[341,464,466],{"id":465},"reservedformkeyerror",[21,467,468],{},"ReservedFormKeyError",[17,470,418,471,474,475,477],{},[21,472,473],{},"__atta:"," namespace is reserved for internal use; passing a form key starting with ",[21,476,473],{}," throws. Pick a different prefix.",[341,479,481],{"id":480},"anonpersisterror",[21,482,483],{},"AnonPersistError",[17,485,486,487,490],{},"Persistence is configured on an anonymous (no ",[21,488,489],{},"key",") form. The cause property distinguishes:",[492,493,494,504],"ul",{},[495,496,497,500,501,503],"li",{},[21,498,499],{},"'no-key'",": no ",[21,502,489],{}," passed; persistence needs a stable key to prefix storage entries.",[495,505,506,509,510,513,514,517],{},[21,507,508],{},"'register-without-config'",": a register call passes ",[21,511,512],{},"{ persist: true }"," against an anonymous form (which wouldn't have a backend even with ",[21,515,516],{},"persist:"," on the form).",[17,519,520,521,524,525,528],{},"Carries ",[21,522,523],{},"schemaFields"," (the leaves on the form's schema, for diagnostic context) and ",[21,526,527],{},"callSite"," (the file:line of the offending call).",[58,530,532],{"id":531},"attaformerrorcode",[21,533,534],{},"AttaformErrorCode",[17,536,537,538,540,541,543,544,547,548,550],{},"A small, stable enum for Attaform-emitted ",[21,539,40],{}," values. The codes follow ",[21,542,44],{}," prefix convention; pair with ",[21,545,546],{},"parseApiErrors"," to read the ",[21,549,21],{}," field reactively in templates.",[70,552,554],{"className":72,"code":553,"language":74,"meta":75,"style":75},"import { AttaformErrorCode } from 'attaform'\n\nif (form.errors.email?.[0]?.code === AttaformErrorCode.NoValueSupplied) {\n  \u002F\u002F …\n}\n",[21,555,556,567,571,592,596],{"__ignoreMap":75},[79,557,558,560,563,565],{"class":81,"line":82},[79,559,86],{"class":85},[79,561,562],{"class":89}," { AttaformErrorCode } ",[79,564,93],{"class":85},[79,566,97],{"class":96},[79,568,569],{"class":81,"line":100},[79,570,104],{"emptyLinePlaceholder":103},[79,572,573,576,579,583,586,589],{"class":81,"line":107},[79,574,575],{"class":85},"if",[79,577,578],{"class":89}," (form.errors.email?.[",[79,580,582],{"class":581},"sj4cs","0",[79,584,585],{"class":89},"]?.code ",[79,587,588],{"class":85},"===",[79,590,591],{"class":89}," AttaformErrorCode.NoValueSupplied) {\n",[79,593,594],{"class":81,"line":116},[79,595,240],{"class":119},[79,597,598],{"class":81,"line":123},[79,599,206],{"class":89},[601,602,603,619],"table",{},[604,605,606],"thead",{},[607,608,609,613,616],"tr",{},[610,611,612],"th",{},"Code value",[610,614,615],{},"Constant",[610,617,618],{},"Emitted when",[620,621,622,645,664,689,708,723],"tbody",{},[607,623,624,630,635],{},[625,626,627],"td",{},[21,628,629],{},"atta:no-value-supplied",[625,631,632],{},[21,633,634],{},"AttaformErrorCode.NoValueSupplied",[625,636,637,638,641,642,56],{},"A required leaf is in ",[21,639,640],{},"blankPaths"," (numeric auto-mark or ",[21,643,644],{},"unset",[607,646,647,652,657],{},[625,648,649],{},[21,650,651],{},"atta:adapter-threw",[625,653,654],{},[21,655,656],{},"AttaformErrorCode.AdapterThrew",[625,658,659,660,663],{},"An ",[21,661,662],{},"AbstractSchema"," method (validate, getDefaults, etc.) threw.",[607,665,666,671,676],{},[625,667,668],{},[21,669,670],{},"atta:validator-threw",[625,672,673],{},[21,674,675],{},"AttaformErrorCode.ValidatorThrew",[625,677,678,679,450,682,450,685,688],{},"User code inside a ",[21,680,681],{},"z.preprocess",[21,683,684],{},".refine",[21,686,687],{},".transform"," threw.",[607,690,691,696,701],{},[625,692,693],{},[21,694,695],{},"atta:hydration-failed",[625,697,698],{},[21,699,700],{},"AttaformErrorCode.HydrationFailed",[625,702,703,704,707],{},"A function-form ",[21,705,706],{},"defaultValues"," factory threw or its promise rejected.",[607,709,710,715,720],{},[625,711,712],{},[21,713,714],{},"atta:path-not-found",[625,716,717],{},[21,718,719],{},"AttaformErrorCode.PathNotFound",[625,721,722],{},"A path canonicalization rejected the input as not reachable.",[607,724,725,730,735],{},[625,726,727],{},[21,728,729],{},"atta:activation-failed",[625,731,732],{},[21,733,734],{},"AttaformErrorCode.ActivationFailed",[625,736,737,738,740,741,390],{},"A walked form's async ",[21,739,706],{}," factory threw inside ",[21,742,743],{},"wizard.handleSubmit",[17,745,746],{},"Don't expect every internal failure mode to surface as a stable code; the codes are reserved for cases where consumer templates legitimately want to branch on a specific failure mode without matching message strings.",[58,748,418,750,752],{"id":749},"the-validationerror-shape",[21,751,26],{}," shape",[17,754,755,756,49,759,762],{},"Every error in ",[21,757,758],{},"form.errors.\u003Cpath>",[21,760,761],{},"form.meta.errors",", and the parser's result has this shape:",[70,764,766],{"className":72,"code":765,"language":74,"meta":75,"style":75},"type ValidationError = {\n  readonly path: ReadonlyArray\u003Cstring | number>\n  readonly message: string\n  readonly code: string\n  readonly formKey: string\n}\n",[21,767,768,781,811,823,834,845],{"__ignoreMap":75},[79,769,770,773,776,779],{"class":81,"line":82},[79,771,772],{"class":85},"type",[79,774,775],{"class":146}," ValidationError",[79,777,778],{"class":85}," =",[79,780,113],{"class":89},[79,782,783,786,790,793,796,799,802,805,808],{"class":81,"line":100},[79,784,785],{"class":85},"  readonly",[79,787,789],{"class":788},"s4XuR"," path",[79,791,792],{"class":85},":",[79,794,795],{"class":146}," ReadonlyArray",[79,797,798],{"class":89},"\u003C",[79,800,801],{"class":581},"string",[79,803,804],{"class":85}," |",[79,806,807],{"class":581}," number",[79,809,810],{"class":89},">\n",[79,812,813,815,818,820],{"class":81,"line":107},[79,814,785],{"class":85},[79,816,817],{"class":788}," message",[79,819,792],{"class":85},[79,821,822],{"class":581}," string\n",[79,824,825,827,830,832],{"class":81,"line":116},[79,826,785],{"class":85},[79,828,829],{"class":788}," code",[79,831,792],{"class":85},[79,833,822],{"class":581},[79,835,836,838,841,843],{"class":81,"line":123},[79,837,785],{"class":85},[79,839,840],{"class":788}," formKey",[79,842,792],{"class":85},[79,844,822],{"class":581},[79,846,847],{"class":81,"line":135},[79,848,206],{"class":89},[492,850,851,860,866,880],{},[495,852,853,856,857,56],{},[21,854,855],{},"path",": the canonical segment tuple (",[21,858,859],{},"['profile', 'email']",[495,861,862,865],{},[21,863,864],{},"message",": the human-readable error text.",[495,867,868,870,871,49,873,49,876,879],{},[21,869,21],{},": stable identifier (",[21,872,629],{},[21,874,875],{},"zod:invalid_type",[21,877,878],{},"api:duplicate-email",", etc.).",[495,881,882,885],{},[21,883,884],{},"formKey",": which form emitted the error. Useful for cross-form aggregation in wizards.",[17,887,418,888,890,891,893,894,896],{},[21,889,21],{}," is what consumers branch on; the ",[21,892,864],{}," is what templates render. Avoid matching ",[21,895,864],{}," strings; they're localized and may change over time without breaking the public contract.",[58,898,900],{"id":899},"code-prefixes-by-source","Code prefixes by source",[601,902,903,913],{},[604,904,905],{},[607,906,907,910],{},[610,908,909],{},"Prefix",[610,911,912],{},"Source",[620,914,915,927,946],{},[607,916,917,921],{},[625,918,919],{},[21,920,44],{},[625,922,923,924,926],{},"Attaform-emitted (the ",[21,925,534],{}," values).",[607,928,929,934],{},[625,930,931],{},[21,932,933],{},"zod:",[625,935,936,937,940,941,49,943,879],{},"Zod adapter (computed from ",[21,938,939],{},"issue.code",": ",[21,942,875],{},[21,944,945],{},"zod:too_small",[607,947,948,952],{},[625,949,950],{},[21,951,48],{},[625,953,954,955,49,957,959],{},"Conventional prefix for consumer-emitted server errors. Pick whatever convention fits the app: ",[21,956,52],{},[21,958,55],{},", etc.",[17,961,962],{},"The prefix tells you where the error came from without parsing the rest of the string.",[58,964,966],{"id":965},"where-to-next","Where to next",[492,968,969,981,993],{},[495,970,971,977,978,980],{},[972,973,975],"a",{"href":974},"\u002Fdocs\u002Fserver-and-ssr\u002Fparse-api-errors",[21,976,546],{},": generate consumer-coded ",[21,979,26],{},"s from server responses.",[495,982,983,990,991,390],{},[972,984,418,986,989],{"href":985},"\u002Fdocs\u002Fvalidation\u002Fblank",[21,987,988],{},"blank"," field-state bit",": the side-channel that surfaces ",[21,992,629],{},[495,994,995,999,1000,390],{},[972,996,998],{"href":997},"\u002Fdocs\u002Fsubmitting\u002Fserver-side-errors","Server-side errors",": the full flow from API failure to reactive ",[21,1001,1002],{},"form.errors",[1004,1005,1006],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":75,"searchDepth":100,"depth":100,"links":1008},[1009,1010,1020,1021,1023,1024],{"id":60,"depth":100,"text":61},{"id":338,"depth":100,"text":339,"children":1011},[1012,1013,1014,1015,1016,1017,1018,1019],{"id":343,"depth":107,"text":67},{"id":372,"depth":107,"text":375},{"id":393,"depth":107,"text":396},{"id":412,"depth":107,"text":415},{"id":429,"depth":107,"text":432},{"id":442,"depth":107,"text":445},{"id":465,"depth":107,"text":468},{"id":480,"depth":107,"text":483},{"id":531,"depth":100,"text":534},{"id":749,"depth":100,"text":1022},"The ValidationError shape",{"id":899,"depth":100,"text":900},{"id":965,"depth":100,"text":966},"Every Attaform-emitted error class and every AttaformErrorCode. Catch AttaformError once, branch on subclass, and code-key Attaform's validations through the small set of stable identifiers.","md",{},[1029,1032,1035,1037],{"label":1030,"value":1031},"Category","Reference",{"label":1033,"value":1034,"kind":21},"Base class","AttaformError extends Error",{"label":1036,"value":44,"kind":21},"Code prefix",{"label":1038,"value":1039},"Match by","instanceof for classes, code for ValidationError","\u002Fdocs\u002Freference\u002Ferrors",{"title":5,"description":1025},null,"docs\u002Freference\u002Ferrors","tIBrmqsCZRYtiyRMJeKwiq4yu716kmHD6icUW49J4zw",1780949762386]