srbhr/Resume-Matcher · error · HTTPException

missing_placeholders

missing_placeholders

Error message

missing_placeholders

What it means

A structured 422 validation error with detail {code:'missing_placeholders', field:'cover_letter_prompt', missing:[...]} raised by update_feature_prompts. validate_prompt_placeholders found that the supplied cover letter prompt is missing required template placeholders (e.g. {job_description}, {company}), which would break content generation.

Source

Thrown at apps/backend/app/routers/config.py:434

    request: FeaturePromptsRequest,
) -> FeaturePromptsResponse:
    """Update custom feature prompts.

    Non-empty prompts are validated for the three required placeholders
    (``{job_description}``, ``{resume_data}``, ``{output_language}``).
    Missing placeholders return a 422 with a structured detail so the UI
    can list exactly which ones are absent. Empty strings clear the
    override — persisted as ``""`` so runtime resolution falls back to the
    built-in default.
    """
    stored = _load_config()

    if request.cover_letter_prompt is not None:
        prompt = request.cover_letter_prompt.strip()
        if prompt:
            missing = validate_prompt_placeholders(prompt)
            if missing:
                raise HTTPException(
                    status_code=422,
                    detail={
                        "code": "missing_placeholders",
                        "field": "cover_letter_prompt",
                        "missing": missing,
                    },
                )
        stored["cover_letter_prompt"] = prompt

    if request.outreach_message_prompt is not None:
        prompt = request.outreach_message_prompt.strip()
        if prompt:
            missing = validate_prompt_placeholders(prompt)
            if missing:
                raise HTTPException(
                    status_code=422,
                    detail={
                        "code": "missing_placeholders",

View on GitHub (pinned to 116f9cc3b0)

Solutions

  1. Add the placeholders listed in detail.missing back into cover_letter_prompt
  2. Copy the default prompt as a starting point and edit around the placeholders
  3. If the prompt is intentionally empty, send null or an empty string instead of a partial prompt

Example fix

// before
prompt = "Write a friendly cover letter."
// after
prompt = "Write a friendly cover letter for {company} based on: {job_description}"
Defensive patterns

Strategy: validation

Validate before calling

const REQUIRED = ['{job_description}', '{company}']
const missing = REQUIRED.filter(p => !prompt.includes(p))
if (missing.length) throw new Error(`missing placeholders: ${missing.join(', ')}`)

Try / catch

try {
  await api.updateFeaturePrompts({ cover_letter_prompt: prompt })
} catch (e) {
  const d = e.response?.data?.detail
  if (d?.code === 'missing_placeholders') {
    highlightField('cover_letter_prompt', `Missing: ${d.missing.join(', ')}`)
  } else throw e
}

Prevention

When it happens

Trigger: PUT/POST feature prompts with a non-empty cover_letter_prompt that omits one or more required placeholders; typically after hand-editing a prompt and deleting a placeholder token.

Common situations: User rewrites a prompt for tone and accidentally removes a variable; copy-pasting a prompt from docs of a different version with different placeholder requirements.

Related errors


AI-assisted analysis of srbhr/Resume-Matcher@116f9cc3b0 (2026-08-28). Data as JSON: /api/errors/0f28a10700bfbd8c. Report an issue: GitHub.