{"record":{"id":"b55bd9692b1b9fb7","repo":"affaan-m/ECC","slug":"interview-produced-an-invalid-profile-problems","errorCode":null,"errorMessage":"interview produced an invalid profile: {problems}","messagePattern":"interview produced an invalid profile: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/interview.py","lineNumber":96,"sourceCode":"\n    brief = (answers.get(\"brief\") or \"\").strip()\n    if not brief:\n        unanswered.append(\"brief\")\n\n    profile = {\n        \"schema_version\": 1,\n        \"genre\": genre,\n        \"created\": _utc_now(),\n        \"answers\": {k: str(v).strip() for k, v in answers.items() if str(v).strip()},\n        \"unanswered\": unanswered,\n        \"constraints\": {\n            \"look\": look,\n            \"content\": {\"brief\": brief},\n        },\n    }\n    problems = schema.validate(profile, schema.TASTE_PROFILE_SCHEMA)\n    if problems:\n        raise ValueError(f\"interview produced an invalid profile: {problems}\")\n    return profile\n","sourceCodeStart":78,"sourceCodeEnd":98,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/interview.py#L78-L98","documentation":"conduct() runs the taste interview and validates the assembled profile dict against TASTE_PROFILE_SCHEMA before returning it. If any required key, type, or structure is missing or wrong, the interviewer refuses to emit the profile and lists the schema problems. It is an internal invariant: the interview flow itself produced a malformed profile.","triggerScenarios":"The interview answers collected do not populate every schema-required field (e.g. missing 'look', empty 'content'/'brief', wrong nesting of 'answers'/'content'), so schema.validate returns non-empty problems.","commonSituations":"Customizing interview question flows and dropping a question whose answer feeds a required profile field; programmatic invocation of conduct() with mocked/empty answer inputs; schema updated to require new fields while the interview code still builds the old shape.","solutions":["Inspect the `problems` list in the message — it names each missing/mistyped field","Ensure every interview question that feeds a required schema field is asked and non-empty before building the profile","Run schema.validate(profile, schema.TASTE_PROFILE_SCHEMA) on your assembled answers locally to reproduce","Update the profile-building code to match the current TASTE_PROFILE_SCHEMA if the schema recently changed"],"exampleFix":"// before: brief collected but 'look' question skipped\nprofile['answers'] = {'content': {'brief': brief}}\n\n// after: all required answers gathered first\nassert look and brief, 'interview must collect look and brief'\nprofile['answers'] = {'look': look, 'content': {'brief': brief}}","handlingStrategy":"validation","validationCode":"from tasteforge.scripts.tasteforge import schema\nproblems = schema.validate(profile, schema.TASTE_PROFILE_SCHEMA)\nif problems:\n    raise ValueError(f'profile invalid before conduct(): {problems}')","typeGuard":"def is_valid_profile(profile):\n    return isinstance(profile, dict) and not schema.validate(profile, schema.TASTE_PROFILE_SCHEMA)","tryCatchPattern":"try:\n    profile = interview.conduct(answers)\nexcept ValueError as e:\n    logger.error('interview profile rejected: %s', e)\n    raise","preventionTips":["Validate intermediate answer dicts with TASTE_PROFILE_SCHEMA before passing them in","Keep the interview question list in sync with schema-required fields","Cover conduct() with a unit test asserting a valid profile for canonical answers","Re-run validation whenever the schema evolves"],"tags":["python","schema","validation","interview"],"backgroundTag":"schema-validation-failed","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}