{"record":{"id":"fc844592f7a13c5a","repo":"pydantic/monty","slug":"unknown-monty-marker-type-string-object-type-marker","errorCode":null,"errorMessage":"Unknown Monty marker type: ${String(object[TYPE_MARKER])}","messagePattern":"Unknown Monty marker type: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"crates/monty-js/ts/worker/value.ts","lineNumber":149,"sourceCode":"          excType: String(object.excType),\n          ...(typeof object.message === 'string' ? { message: object.message } : {}),\n        },\n      }\n    case 'ClassInstance':\n      return pushClassInstance(object, nodes)\n    case 'FileHandle':\n      return pushFileHandle(object)\n    case 'Type':\n      // A class type marker (`classType`) crosses structurally; builtin type\n      // markers carry only the name.\n      if (typeof object.classType === 'object' && object.classType !== null) {\n        return { tag: 'class-type', val: pushClassType(object.classType as Record<string, unknown>, nodes) }\n      }\n      return { tag: 'type-name', val: String(object.value) }\n    case 'BuiltinFunction':\n      return { tag: 'builtin-function', val: String(object.value) }\n    default:\n      throw new TypeError(`Unknown Monty marker type: ${String(object[TYPE_MARKER])}`)\n  }\n}\n\n/** Preserves aware-time metadata while rejecting an orphaned timezone name. */\nfunction timeZoneFields(\n  object: Record<string, unknown>,\n  typeName: 'DateTime' | 'Time',\n): { offsetSeconds?: number; timezoneName?: string } {\n  const aware = object.offsetSeconds !== undefined && object.offsetSeconds !== null\n  if (!aware && object.timezoneName !== undefined && object.timezoneName !== null) {\n    throw new TypeError(`Monty${typeName} timezoneName requires offsetSeconds`)\n  }\n  return aware\n    ? {\n        offsetSeconds: Number(object.offsetSeconds),\n        ...(typeof object.timezoneName === 'string' ? { timezoneName: object.timezoneName } : {}),\n      }\n    : {}","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/pydantic/monty/blob/adc986b362e3961f407868cb118a99fe831b9e61/crates/monty-js/ts/worker/value.ts#L131-L167","documentation":"pushMarked converts Monty's marker-tagged value objects (values carrying a TYPE_MARKER symbol) into flat wire nodes for the wasm worker transport. This TypeError is thrown when the marker string does not match any known marker type in the switch, meaning the object was forged, corrupted, or produced by a mismatched monty version.","triggerScenarios":"Passing a plain or hand-built object with a TYPE_MARKER property whose value is not one of the recognized markers (e.g. 'DateTime', 'ClassInstance', 'BuiltinFunction', etc.) into session inputs or external-function return values; using a @pydantic/monty package version whose marker names differ from the native binary's.","commonSituations":"Version mismatch between the JS wrapper and the wasm/native runtime after an upgrade; constructing marker objects manually instead of using returned values; deserializing values that were corrupted in transit or by user serialization.","solutions":["Pass only values originally produced by the monty runtime (or documented input shapes), never hand-built marker objects","Align @pydantic/monty and the monty binary/wasm component to the same released version","Log String(object[TYPE_MARKER]) to identify the unrecognized marker and check whether it is a newer marker type your wrapper does not know","If intentionally extending, add the marker to pushMarked's switch"],"exampleFix":"// before\nconst input = { [TYPE_MARKER]: 'CustomThing', value: 1 } // unknown marker\n// after\nconst input = 1 // plain JS value, or a value received from the runtime","handlingStrategy":"type-guard","validationCode":"function isKnownMarker(v: unknown): boolean {\n  const KNOWN = new Set(['DateTime','Time','TimeDelta','Date','ClassInstance','ClassType','BuiltinFunction','TypeName','Uuid' /* etc */])\n  return typeof v === 'object' && v !== null && KNOWN.has(String((v as any)[TYPE_MARKER]))\n}","typeGuard":"const isMarked = (v: unknown): v is Record<PropertyKey, unknown> =>\n  typeof v === 'object' && v !== null && typeof (v as any)[TYPE_MARKER] === 'string'","tryCatchPattern":"try {\n  const node = pushValue(input, nodes)\n} catch (e) {\n  if (e instanceof TypeError && e.message.startsWith('Unknown Monty marker type')) {\n    throw new Error(`Unconvertible input value: ${e.message}`)\n  }\n  throw e\n}","preventionTips":["Only pass values produced by the runtime or plain JSON-safe values as inputs/return values","Keep @pydantic/monty, the native binary and wasm component on the same version","Never construct TYPE_MARKER objects by hand"],"tags":["typescript","wasm","serialization","value-conversion"],"backgroundTag":"invalid-enum-value","analyzedSha":"adc986b362e3961f407868cb118a99fe831b9e61","analyzedAt":"2026-09-13T19:19:18.698Z","contentChangedAt":"2026-09-13T19:19:18.698Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}