{"record":{"id":"9bdc802501f8598b","repo":"Automattic/harper","slug":"expected-glue-flavor-to-be-full-or-slim-but-go","errorCode":null,"errorMessage":"Expected glue flavor to be \"full\" or \"slim\" but got ${glueFlavor}.","messagePattern":"Expected glue flavor to be \"full\" or \"slim\" but got (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/harper.js/src/WorkerLinter/worker.ts","lineNumber":16,"sourceCode":"/// <reference lib=\"webworker\" />\nimport './shims';\nimport { SuperBinaryModule, type WasmGlueFlavor } from '../BinaryModule';\nimport LocalLinter from '../LocalLinter';\nimport Serializer, { isSerializedRequest, type SerializedRequest } from '../Serializer';\n\n// Notify the main thread that we are ready\nself.postMessage('ready');\n\nself.onmessage = (e) => {\n\tconst [binaryUrl, dialect, glueFlavor] = e.data;\n\tif (typeof binaryUrl !== 'string') {\n\t\tthrow new TypeError(`Expected binary to be a string of url but got ${typeof binaryUrl}.`);\n\t}\n\tif (glueFlavor !== undefined && glueFlavor !== 'full' && glueFlavor !== 'slim') {\n\t\tthrow new TypeError(`Expected glue flavor to be \"full\" or \"slim\" but got ${glueFlavor}.`);\n\t}\n\tconst binary = SuperBinaryModule.create(binaryUrl, glueFlavor as WasmGlueFlavor | undefined);\n\tconst serializer = new Serializer(binary);\n\tconst linter = new LocalLinter({ binary, dialect });\n\n\tasync function processRequest(v: SerializedRequest) {\n\t\tconst { procName, args } = await serializer.deserialize(v);\n\n\t\tif (procName in linter) {\n\t\t\t// @ts-expect-error\n\t\t\tconst res = await linter[procName](...args);\n\t\t\tpostMessage(await serializer.serializeArg(res));\n\t\t}\n\t}\n\n\tself.onmessage = (e) => {\n\t\tif (isSerializedRequest(e.data)) {\n\t\t\tprocessRequest(e.data);","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/Automattic/harper/blob/5fe7d5ab76492d83f3ecdbc3f1da83c75dcb6f83/packages/harper.js/src/WorkerLinter/worker.ts#L1-L34","documentation":"Worker bootstrap validates the optional third element of the handshake message: glueFlavor must be undefined, 'full', or 'slim'. Any other value throws this TypeError. The glue flavor selects which WASM glue (full vs slim) SuperBinaryModule should load.","triggerScenarios":"Passing a glueFlavor other than 'full'/'slim'/undefined into WorkerLinter's worker handshake — e.g. a typo ('Full', 'full-glue'), null, a number, or hand-crafted postMessage data with extra/misordered elements so dialect lands in the glueFlavor slot.","commonSituations":"Typo'd enum in WorkerLinter options; manually posting [url, dialect, 'slim '] (whitespace); array destructuring off by one when constructing the handshake message yourself.","solutions":["Use exactly 'full', 'slim', or omit the value","Fix typos and casing ('full' not 'Full')","If constructing the message manually, verify element order [binaryUrl, dialect, glueFlavor]","Consult the WorkerLinter docs/tests for valid WasmGlueFlavor values"],"exampleFix":"// before\nnew WorkerLinter({ ..., glueFlavor: 'Full' });\n// after\nnew WorkerLinter({ ..., glueFlavor: 'full' });","handlingStrategy":"validation","validationCode":"const GLUE_FLAVORS = ['full', 'slim'] as const;\nif (glueFlavor !== undefined && !GLUE_FLAVORS.includes(glueFlavor as any)) {\n  throw new Error(`glueFlavor must be 'full', 'slim', or undefined`);\n}","typeGuard":"type WasmGlueFlavor = 'full' | 'slim';\nfunction isGlueFlavor(v: unknown): v is WasmGlueFlavor | undefined {\n  return v === undefined || v === 'full' || v === 'slim';\n}","tryCatchPattern":"try {\n  const linter = new WorkerLinter({ binary, glueFlavor });\n  await linter.setup();\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('glue flavor')) {\n    console.error('Invalid glueFlavor:', glueFlavor);\n  }\n  throw e;\n}","preventionTips":["Use the exported WasmGlueFlavor type so typos fail at compile time","Spell values exactly as 'full' or 'slim' (lowercase)","If building the worker handshake manually, verify tuple order [binaryUrl, dialect, glueFlavor]"],"tags":["worker","wasm","invalid-enum-value","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"5fe7d5ab76492d83f3ecdbc3f1da83c75dcb6f83","analyzedAt":"2026-09-06T11:34:38.610Z","contentChangedAt":"2026-09-06T11:34:38.610Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}