{"id":"7576a56978dee261","repo":"drizzle-team/drizzle-orm","slug":"no-value-for-placeholder-p-value-name-was-pro","errorCode":null,"errorMessage":"No value for placeholder \"${p.value.name}\" was provided","messagePattern":"No value for placeholder \"(.+?)\" was provided","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/sql/sql.ts","lineNumber":624,"sourceCode":"\n/** @deprecated Use `sql.placeholder` instead. */\nexport function placeholder<TName extends string>(name: TName): Placeholder<TName> {\n\treturn new Placeholder(name);\n}\n\nexport function fillPlaceholders(params: unknown[], values: Record<string, unknown>): unknown[] {\n\treturn params.map((p) => {\n\t\tif (is(p, Placeholder)) {\n\t\t\tif (!(p.name in values)) {\n\t\t\t\tthrow new Error(`No value for placeholder \"${p.name}\" was provided`);\n\t\t\t}\n\n\t\t\treturn values[p.name];\n\t\t}\n\n\t\tif (is(p, Param) && is(p.value, Placeholder)) {\n\t\t\tif (!(p.value.name in values)) {\n\t\t\t\tthrow new Error(`No value for placeholder \"${p.value.name}\" was provided`);\n\t\t\t}\n\n\t\t\treturn p.encoder.mapToDriverValue(values[p.value.name]);\n\t\t}\n\n\t\treturn p;\n\t});\n}\n\nexport type ColumnsSelection = Record<string, unknown>;\n\nconst IsDrizzleView = Symbol.for('drizzle:IsDrizzleView');\n\nexport abstract class View<\n\tTName extends string = string,\n\tTExisting extends boolean = boolean,\n\tTSelection extends ColumnsSelection = ColumnsSelection,\n> implements SQLWrapper {","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/sql/sql.ts#L606-L642","documentation":"Thrown by fillPlaceholders() (sql.ts:624) for the same reason as 144, but the placeholder is wrapped inside a Param object that carries a custom column encoder (e.g. a typed placeholder bound to a column). Drizzle still needs the named value from the values map and throws when it is missing.","triggerScenarios":"Using a column-bound placeholder (e.g. new Param(new Placeholder('x'), column)) — typically produced by passing a placeholder through a typed column context — then executing without supplying that name in placeholderValues.","commonSituations":"Building typed parameterised fragments with sql.placeholder inside typed column expressions; refactoring encoders; placeholders created indirectly through helper functions that wrap them in Param.","solutions":["Supply every placeholder name in the placeholderValues argument at execute time.","Log the names of placeholders embedded in the query before executing to catch missing keys.","Centralise placeholder-name constants to avoid drift between build and call sites."],"exampleFix":"// before\nconst q = db.select().from(users)\n  .where(sql`${users.id} = ${sql.placeholder('uid')}`).prepare();\nawait q.all({ wrong: 1 }); // throws\n\n// after\nawait q.all({ uid: 1 });","handlingStrategy":"validation","validationCode":"// same as 144: ensure every placeholder name (including those wrapped in Param/encoder)\n// is present in the values object before calling execute/all/run.\nfunction assertPlaceholders(names: string[], values: Record<string, unknown>) {\n  const missing = names.filter((n) => !(n in values));\n  if (missing.length) throw new Error('Missing placeholder values: ' + missing.join(', '));\n}","typeGuard":"const hasAllKeys = (obj, keys: string[]) => keys.every((k) => k in obj);","tryCatchPattern":null,"preventionTips":["Keep placeholder-name constants in one place for both build and execute.","When wrapping placeholders in typed Param helpers, document the required value keys.","Unit-test prepared queries against a complete values fixture."],"tags":["placeholders","prepared-query","params","encoder"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}