[{"data":1,"prerenderedAt":1004},["ShallowReactive",2],{"content-\u002Fdocs\u002Freference\u002Ferrors":3},{"id":4,"title":5,"body":6,"description":984,"extension":985,"meta":986,"metaRows":987,"navigation":103,"path":999,"seo":1000,"source":1001,"stem":1002,"__hash__":1003},"docs\u002Fdocs\u002Freference\u002Ferrors.md","Errors reference",{"type":7,"value":8,"toc":967},"minimark",[9,13,28,31,57,62,69,207,210,312,316,322,325,346,352,367,373,386,392,403,409,416,422,439,445,454,460,472,521,665,668,674,684,788,857,868,872,931,934,938,963],[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, 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, 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 } 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 AttaformError) {\n    \u002F\u002F Catch-all\n  } else {\n    throw err\n  }\n}\n",[21,214,215,226,230,236,241,249,262,267,284,289,297,303,307],{"__ignoreMap":75},[79,216,217,219,222,224],{"class":81,"line":82},[79,218,86],{"class":85},[79,220,221],{"class":89}," { AttaformError, OutsideSetupError } ",[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,282],{"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,147],{"class":146},[79,283,150],{"class":89},[79,285,286],{"class":81,"line":177},[79,287,288],{"class":119},"    \u002F\u002F Catch-all\n",[79,290,291,293,295],{"class":81,"line":188},[79,292,180],{"class":89},[79,294,183],{"class":85},[79,296,113],{"class":89},[79,298,299,301],{"class":81,"line":197},[79,300,191],{"class":85},[79,302,194],{"class":89},[79,304,305],{"class":81,"line":203},[79,306,200],{"class":89},[79,308,310],{"class":81,"line":309},13,[79,311,206],{"class":89},[58,313,315],{"id":314},"error-classes","Error classes",[317,318,320],"h3",{"id":319},"attaformerror",[21,321,67],{},[17,323,324],{},"Base class; never thrown directly, only via subclasses. Provides the polymorphic-catch entry point.",[70,326,328],{"className":72,"code":327,"language":74,"meta":75,"style":75},"class AttaformError extends Error {}\n",[21,329,330],{"__ignoreMap":75},[79,331,332,335,337,340,343],{"class":81,"line":82},[79,333,334],{"class":85},"class",[79,336,147],{"class":146},[79,338,339],{"class":85}," extends",[79,341,342],{"class":146}," Error",[79,344,345],{"class":89}," {}\n",[317,347,349],{"id":348},"invalidpatherror",[21,350,351],{},"InvalidPathError",[17,353,354,355,358,359,362,363,366],{},"A path string can't be canonicalized against the form's schema. Typical cause: a typo in ",[21,356,357],{},"register('parh')"," or ",[21,360,361],{},"setValue('a.bb.c')"," against a schema with no ",[21,364,365],{},".bb",".",[317,368,370],{"id":369},"invaliduseformconfigerror",[21,371,372],{},"InvalidUseFormConfigError",[17,374,375,378,379,382,383,56],{},[21,376,377],{},"useForm"," received an invalid configuration, most often a schema passed directly instead of inside an options object (",[21,380,381],{},"useForm(schema)"," rather than ",[21,384,385],{},"useForm({ schema })",[317,387,389],{"id":388},"submiterrorhandlererror",[21,390,391],{},"SubmitErrorHandlerError",[17,393,394,395,398,399,402],{},"The ",[21,396,397],{},"onError"," callback passed to ",[21,400,401],{},"handleSubmit"," threw. Caught and re-thrown wrapped in this class so the wrapping submit lifecycle can distinguish \"user error handler crashed\" from \"validation failed.\"",[317,404,406],{"id":405},"registrynotinstallederror",[21,407,408],{},"RegistryNotInstalledError",[17,410,411,412,415],{},"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,413,414],{},"useRegistry()"," was called from outside a Vue app's lifecycle.",[317,417,419],{"id":418},"outsidesetuperror",[21,420,421],{},"OutsideSetupError",[17,423,424,426,427,430,431,434,435,438],{},[21,425,377],{}," \u002F ",[21,428,429],{},"injectForm"," \u002F similar composable called outside Vue setup. Move the call inside a ",[21,432,433],{},"setup()"," function or ",[21,436,437],{},"\u003Cscript setup>"," block.",[317,440,442],{"id":441},"reservedformkeyerror",[21,443,444],{},"ReservedFormKeyError",[17,446,394,447,450,451,453],{},[21,448,449],{},"__atta:"," namespace is reserved for internal use; passing a form key starting with ",[21,452,449],{}," throws. Pick a different prefix.",[58,455,457],{"id":456},"attaformerrorcode",[21,458,459],{},"AttaformErrorCode",[17,461,462,463,465,466,468,469,471],{},"A small, stable enum for Attaform-emitted ",[21,464,40],{}," values. The codes follow the ",[21,467,44],{}," prefix convention, so templates can branch on ",[21,470,21],{}," rather than matching message strings.",[70,473,475],{"className":72,"code":474,"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,476,477,488,492,513,517],{"__ignoreMap":75},[79,478,479,481,484,486],{"class":81,"line":82},[79,480,86],{"class":85},[79,482,483],{"class":89}," { AttaformErrorCode } ",[79,485,93],{"class":85},[79,487,97],{"class":96},[79,489,490],{"class":81,"line":100},[79,491,104],{"emptyLinePlaceholder":103},[79,493,494,497,500,504,507,510],{"class":81,"line":107},[79,495,496],{"class":85},"if",[79,498,499],{"class":89}," (form.errors.email?.[",[79,501,503],{"class":502},"sj4cs","0",[79,505,506],{"class":89},"]?.code ",[79,508,509],{"class":85},"===",[79,511,512],{"class":89}," AttaformErrorCode.NoValueSupplied) {\n",[79,514,515],{"class":81,"line":116},[79,516,240],{"class":119},[79,518,519],{"class":81,"line":123},[79,520,206],{"class":89},[522,523,524,540],"table",{},[525,526,527],"thead",{},[528,529,530,534,537],"tr",{},[531,532,533],"th",{},"Code value",[531,535,536],{},"Constant",[531,538,539],{},"Emitted when",[541,542,543,566,585,610,629,644],"tbody",{},[528,544,545,551,556],{},[546,547,548],"td",{},[21,549,550],{},"atta:no-value-supplied",[546,552,553],{},[21,554,555],{},"AttaformErrorCode.NoValueSupplied",[546,557,558,559,562,563,56],{},"A required leaf is in ",[21,560,561],{},"blankPaths"," (numeric auto-mark or ",[21,564,565],{},"unset",[528,567,568,573,578],{},[546,569,570],{},[21,571,572],{},"atta:adapter-threw",[546,574,575],{},[21,576,577],{},"AttaformErrorCode.AdapterThrew",[546,579,580,581,584],{},"An ",[21,582,583],{},"AbstractSchema"," method (validate, getDefaults, etc.) threw.",[528,586,587,592,597],{},[546,588,589],{},[21,590,591],{},"atta:validator-threw",[546,593,594],{},[21,595,596],{},"AttaformErrorCode.ValidatorThrew",[546,598,599,600,426,603,426,606,609],{},"User code inside a ",[21,601,602],{},"z.preprocess",[21,604,605],{},".refine",[21,607,608],{},".transform"," threw.",[528,611,612,617,622],{},[546,613,614],{},[21,615,616],{},"atta:hydration-failed",[546,618,619],{},[21,620,621],{},"AttaformErrorCode.HydrationFailed",[546,623,624,625,628],{},"A function-form ",[21,626,627],{},"defaultValues"," factory threw or its promise rejected.",[528,630,631,636,641],{},[546,632,633],{},[21,634,635],{},"atta:path-not-found",[546,637,638],{},[21,639,640],{},"AttaformErrorCode.PathNotFound",[546,642,643],{},"A path canonicalization rejected the input as not reachable.",[528,645,646,651,656],{},[546,647,648],{},[21,649,650],{},"atta:activation-failed",[546,652,653],{},[21,654,655],{},"AttaformErrorCode.ActivationFailed",[546,657,658,659,661,662,366],{},"A walked form's async ",[21,660,627],{}," factory threw inside ",[21,663,664],{},"wizard.handleSubmit",[17,666,667],{},"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,669,394,671,673],{"id":670},"the-validationerror-shape",[21,672,26],{}," shape",[17,675,676,677,49,680,683],{},"Every error in ",[21,678,679],{},"form.errors.\u003Cpath>",[21,681,682],{},"form.meta.errors",", and the parser's result has this shape:",[70,685,687],{"className":72,"code":686,"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  readonly data?: Json | null\n}\n",[21,688,689,702,732,744,755,766,784],{"__ignoreMap":75},[79,690,691,694,697,700],{"class":81,"line":82},[79,692,693],{"class":85},"type",[79,695,696],{"class":146}," ValidationError",[79,698,699],{"class":85}," =",[79,701,113],{"class":89},[79,703,704,707,711,714,717,720,723,726,729],{"class":81,"line":100},[79,705,706],{"class":85},"  readonly",[79,708,710],{"class":709},"s4XuR"," path",[79,712,713],{"class":85},":",[79,715,716],{"class":146}," ReadonlyArray",[79,718,719],{"class":89},"\u003C",[79,721,722],{"class":502},"string",[79,724,725],{"class":85}," |",[79,727,728],{"class":502}," number",[79,730,731],{"class":89},">\n",[79,733,734,736,739,741],{"class":81,"line":107},[79,735,706],{"class":85},[79,737,738],{"class":709}," message",[79,740,713],{"class":85},[79,742,743],{"class":502}," string\n",[79,745,746,748,751,753],{"class":81,"line":116},[79,747,706],{"class":85},[79,749,750],{"class":709}," code",[79,752,713],{"class":85},[79,754,743],{"class":502},[79,756,757,759,762,764],{"class":81,"line":123},[79,758,706],{"class":85},[79,760,761],{"class":709}," formKey",[79,763,713],{"class":85},[79,765,743],{"class":502},[79,767,768,770,773,776,779,781],{"class":81,"line":135},[79,769,706],{"class":85},[79,771,772],{"class":709}," data",[79,774,775],{"class":85},"?:",[79,777,778],{"class":146}," Json",[79,780,725],{"class":85},[79,782,783],{"class":502}," null\n",[79,785,786],{"class":81,"line":153},[79,787,206],{"class":89},[789,790,791,817,823,837,843],"ul",{},[792,793,794,797,798,801,802,805,806,809,810,813,814,366],"li",{},[21,795,796],{},"path",": the canonical segment tuple (",[21,799,800],{},"['profile', 'email']","). Field errors carry their field's path; global, form-level errors (a root ",[21,803,804],{},".refine()",", a path-less ",[21,807,808],{},"setErrors"," call) carry the empty root path ",[21,811,812],{},"[]"," and read through ",[21,815,816],{},"form.errors([])",[792,818,819,822],{},[21,820,821],{},"message",": the human-readable error text.",[792,824,825,827,828,49,830,49,833,836],{},[21,826,21],{},": stable identifier (",[21,829,550],{},[21,831,832],{},"zod:invalid_type",[21,834,835],{},"api:duplicate-email",", etc.).",[792,838,839,842],{},[21,840,841],{},"formKey",": which form emitted the error. Useful for cross-form aggregation in wizards.",[792,844,845,848,849,852,853,856],{},[21,846,847],{},"data",": optional, opaque JSON payload a server attached to the error (a captcha challenge, a lockout ",[21,850,851],{},"unlocks_at"," timestamp, an MFA step-up descriptor). Attaform carries it untouched; your UI reads it. Typed as ",[21,854,855],{},"Json"," (the JSON-serialisable value shape).",[17,858,394,859,861,862,864,865,867],{},[21,860,21],{}," is what consumers branch on; the ",[21,863,821],{}," is what templates render. Avoid matching ",[21,866,821],{}," strings; they're localized and may change over time without breaking the public contract.",[58,869,871],{"id":870},"code-prefixes-by-source","Code prefixes by source",[522,873,874,884],{},[525,875,876],{},[528,877,878,881],{},[531,879,880],{},"Prefix",[531,882,883],{},"Source",[541,885,886,898,917],{},[528,887,888,892],{},[546,889,890],{},[21,891,44],{},[546,893,894,895,897],{},"Attaform-emitted (the ",[21,896,459],{}," values).",[528,899,900,905],{},[546,901,902],{},[21,903,904],{},"zod:",[546,906,907,908,911,912,49,914,836],{},"Zod adapter (computed from ",[21,909,910],{},"issue.code",": ",[21,913,832],{},[21,915,916],{},"zod:too_small",[528,918,919,923],{},[546,920,921],{},[21,922,48],{},[546,924,925,926,49,928,930],{},"Conventional prefix for consumer-emitted server errors. Pick whatever convention fits the app: ",[21,927,52],{},[21,929,55],{},", etc.",[17,932,933],{},"The prefix tells you where the error came from without parsing the rest of the string.",[58,935,937],{"id":936},"where-to-next","Where to next",[789,939,940,953],{},[792,941,942,950,951,366],{},[943,944,394,946,949],"a",{"href":945},"\u002Fdocs\u002Fvalidation\u002Fblank",[21,947,948],{},"blank"," field-state bit",": the side-channel that surfaces ",[21,952,550],{},[792,954,955,959,960,366],{},[943,956,958],{"href":957},"\u002Fdocs\u002Fsubmitting\u002Fserver-side-errors","Server-side errors",": the full flow from API failure to reactive ",[21,961,962],{},"form.errors",[964,965,966],"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":968},[969,970,979,980,982,983],{"id":60,"depth":100,"text":61},{"id":314,"depth":100,"text":315,"children":971},[972,973,974,975,976,977,978],{"id":319,"depth":107,"text":67},{"id":348,"depth":107,"text":351},{"id":369,"depth":107,"text":372},{"id":388,"depth":107,"text":391},{"id":405,"depth":107,"text":408},{"id":418,"depth":107,"text":421},{"id":441,"depth":107,"text":444},{"id":456,"depth":100,"text":459},{"id":670,"depth":100,"text":981},"The ValidationError shape",{"id":870,"depth":100,"text":871},{"id":936,"depth":100,"text":937},"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",{},[988,991,994,996],{"label":989,"value":990},"Category","Reference",{"label":992,"value":993,"kind":21},"Base class","AttaformError extends Error",{"label":995,"value":44,"kind":21},"Code prefix",{"label":997,"value":998},"Match by","instanceof for classes, code for ValidationError","\u002Fdocs\u002Freference\u002Ferrors",{"title":5,"description":984},null,"docs\u002Freference\u002Ferrors","iAzk3tVmng8uN5bOjmf2TVzaFsL2Ye55cCfXCjV2lRc",1781745874912]