{"abstract":"A malformed type such as \"text/\" or \"/html\" is used verbatim instead of falling back to the default.","category":"Email MIME structure","checks":8,"contract":"header is the raw Content-Type value or None. The type is the lower-cased text before \";\" with surrounding spaces removed; it is valid only with a non-empty major and minor separated by \"/\" and no inner space. Missing or invalid types default to message/rfc822 inside multipart/digest and text/plain everywhere else (parameters of an invalid header are ignored). text/* types get the charset parameter (quotes removed, lower-cased) or us-ascii; other types have charset None. Result [type, charset].","contract_signature":"parent_type, header","evaluation_group":"w2-email_mime_structure-effective-content-type","failed_approach":"Requiring a subtype still accepts a type with an empty major part. The attempted `if slash and minor:` still disagrees with a fixture.","family":"w2-email_mime_structure-effective-content-type-invalid-type-fallback","id":"FA-76386","implementations":{"attempt":{"sha256":"202906554d485ab15419bb8f9c7f9c3d4b636acf258f49642376e557f376a085","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parent_type, header):\n    default = 'message/rfc822' if parent_type == 'multipart/digest' else 'text/plain'\n    mtype = default\n    charset = None\n    if header is not None:\n        head, _, rest = header.partition(';')\n        cand = head.strip().lower()\n        major, slash, minor = cand.partition('/')\n        if slash and minor:\n            mtype = cand\n            for piece in rest.split(';'):\n                k, eq, v = piece.partition('=')\n                if eq and k.strip().lower() == 'charset':\n                    charset = v.strip().strip('\"').lower()\n    if mtype.startswith('text/'):\n        charset = charset or 'us-ascii'\n    else:\n        charset = None\n    return [mtype, charset]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"UTF-8\"'), ['text/html', 'utf-8']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-1'), ['text/plain', 'iso-8859-1']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 2: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"Windows-1252\"'), ['text/html', 'windows-1252']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-2'), ['text/plain', 'iso-8859-2']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 3: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"KOI8-R\"'), ['text/html', 'koi8-r']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-3'), ['text/plain', 'iso-8859-3']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 4: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"Shift_JIS\"'), ['text/html', 'shift_jis']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-4'), ['text/plain', 'iso-8859-4']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 5: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"EUC-KR\"'), ['text/html', 'euc-kr']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-5'), ['text/plain', 'iso-8859-5']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])]}\nfor _label, _args, _expected in _CASES[N]:\n    check(_label, solve(*_args), _expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"6b8f24bf7a6349a55669a0fbaad61703f8be829e513b01b74dab7b95443f9c36","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(parent_type, header):\n    default = 'message/rfc822' if parent_type == 'multipart/digest' else 'text/plain'\n    mtype = default\n    charset = None\n    if header is not None:\n        head, _, rest = header.partition(';')\n        cand = head.strip().lower()\n        major, slash, minor = cand.partition('/')\n        if slash:\n            mtype = cand\n            for piece in rest.split(';'):\n                k, eq, v = piece.partition('=')\n                if eq and k.strip().lower() == 'charset':\n                    charset = v.strip().strip('\"').lower()\n    if mtype.startswith('text/'):\n        charset = charset or 'us-ascii'\n    else:\n        charset = None\n    return [mtype, charset]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_CASES = {1: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"UTF-8\"'), ['text/html', 'utf-8']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-1'), ['text/plain', 'iso-8859-1']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 2: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"Windows-1252\"'), ['text/html', 'windows-1252']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-2'), ['text/plain', 'iso-8859-2']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 3: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"KOI8-R\"'), ['text/html', 'koi8-r']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-3'), ['text/plain', 'iso-8859-3']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 4: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"Shift_JIS\"'), ['text/html', 'shift_jis']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-4'), ['text/plain', 'iso-8859-4']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])], 5: [('digest child without header', ('multipart/digest', None), ['message/rfc822', None]), ('mixed child without header', ('multipart/mixed', None), ['text/plain', 'us-ascii']), ('truncated type in digest', ('multipart/digest', 'text/'), ['message/rfc822', None]), ('missing major type', ('multipart/mixed', '/html; charset=utf-8'), ['text/plain', 'us-ascii']), ('quoted upper-case charset', ('multipart/mixed', 'Text/HTML; charset=\"EUC-KR\"'), ['text/html', 'euc-kr']), ('charset on a binary type', ('multipart/mixed', 'image/png; charset=binary'), ['image/png', None]), ('padded header', ('multipart/alternative', ' text/plain ; charset=ISO-8859-5'), ['text/plain', 'iso-8859-5']), ('nested message parent', ('message/rfc822', None), ['text/plain', 'us-ascii'])]}\nfor _label, _args, _expected in _CASES[N]:\n    check(_label, solve(*_args), _expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Stipulated offline model over pre-parsed MIME dictionaries; not a conforming MIME parser, generator or mail client. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-email_mime_structure-effective-content-type-invalid-type-fallback","generated_at":"2026-09-29T14:49:16.003356+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Default and fallback types decide whether a part is rendered as text, as a nested message or as an attachment.","root_cause":"The invalid type fallback decision evaluates `if slash:` where the contract requires `if slash and major and minor and ' ' not in cand:`.","sha256":"954e98068a9559a1529ac0563d436893936764ca2376491fb193be173e5f0ee4","title":"Resolve a part's effective content type and charset: invalid type fallback · case 01","variant":1,"variant_policy":"N selects a different enumerated fixture set (renamed identifiers, part counts and sizes); boundary fixtures recur across variants.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.738,"exit_code":1,"observations":[{"actual":["message/rfc822",null],"check":"digest child without header","expected":["message/rfc822",null],"passed":true},{"actual":["text/plain","us-ascii"],"check":"mixed child without header","expected":["text/plain","us-ascii"],"passed":true},{"actual":["message/rfc822",null],"check":"truncated type in digest","expected":["message/rfc822",null],"passed":true},{"actual":["/html",null],"check":"missing major type","expected":["text/plain","us-ascii"],"passed":false},{"actual":["text/html","utf-8"],"check":"quoted upper-case charset","expected":["text/html","utf-8"],"passed":true},{"actual":["image/png",null],"check":"charset on a binary type","expected":["image/png",null],"passed":true},{"actual":["text/plain","iso-8859-1"],"check":"padded header","expected":["text/plain","iso-8859-1"],"passed":true},{"actual":["text/plain","us-ascii"],"check":"nested message parent","expected":["text/plain","us-ascii"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"digest child without header\", \"actual\": [\"message/rfc822\", null], \"expected\": [\"message/rfc822\", null], \"passed\": true}, {\"check\": \"mixed child without header\", \"actual\": [\"text/plain\", \"us-ascii\"], \"expected\": [\"text/plain\", \"us-ascii\"], \"passed\": true}, {\"check\": \"truncated type in digest\", \"actual\": [\"message/rfc822\", null], \"expected\": [\"message/rfc822\", null], \"passed\": true}, {\"check\": \"missing major type\", \"actual\": [\"/html\", null], \"expected\": [\"text/plain\", \"us-ascii\"], \"passed\": false}, {\"check\": \"quoted upper-case charset\", \"actual\": [\"text/html\", \"utf-8\"], \"expected\": [\"text/html\", \"utf-8\"], \"passed\": true}, {\"check\": \"charset on a binary type\", \"actual\": [\"image/png\", null], \"expected\": [\"image/png\", null], \"passed\": true}, {\"check\": \"padded header\", \"actual\": [\"text/plain\", \"iso-8859-1\"], \"expected\": [\"text/plain\", \"iso-8859-1\"], \"passed\": true}, {\"check\": \"nested message parent\", \"actual\": [\"text/plain\", \"us-ascii\"], \"expected\": [\"text/plain\", \"us-ascii\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.529,"exit_code":1,"observations":[{"actual":["message/rfc822",null],"check":"digest child without header","expected":["message/rfc822",null],"passed":true},{"actual":["text/plain","us-ascii"],"check":"mixed child without header","expected":["text/plain","us-ascii"],"passed":true},{"actual":["text/","us-ascii"],"check":"truncated type in digest","expected":["message/rfc822",null],"passed":false},{"actual":["/html",null],"check":"missing major type","expected":["text/plain","us-ascii"],"passed":false},{"actual":["text/html","utf-8"],"check":"quoted upper-case charset","expected":["text/html","utf-8"],"passed":true},{"actual":["image/png",null],"check":"charset on a binary type","expected":["image/png",null],"passed":true},{"actual":["text/plain","iso-8859-1"],"check":"padded header","expected":["text/plain","iso-8859-1"],"passed":true},{"actual":["text/plain","us-ascii"],"check":"nested message parent","expected":["text/plain","us-ascii"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"digest child without header\", \"actual\": [\"message/rfc822\", null], \"expected\": [\"message/rfc822\", null], \"passed\": true}, {\"check\": \"mixed child without header\", \"actual\": [\"text/plain\", \"us-ascii\"], \"expected\": [\"text/plain\", \"us-ascii\"], \"passed\": true}, {\"check\": \"truncated type in digest\", \"actual\": [\"text/\", \"us-ascii\"], \"expected\": [\"message/rfc822\", null], \"passed\": false}, {\"check\": \"missing major type\", \"actual\": [\"/html\", null], \"expected\": [\"text/plain\", \"us-ascii\"], \"passed\": false}, {\"check\": \"quoted upper-case charset\", \"actual\": [\"text/html\", \"utf-8\"], \"expected\": [\"text/html\", \"utf-8\"], \"passed\": true}, {\"check\": \"charset on a binary type\", \"actual\": [\"image/png\", null], \"expected\": [\"image/png\", null], \"passed\": true}, {\"check\": \"padded header\", \"actual\": [\"text/plain\", \"iso-8859-1\"], \"expected\": [\"text/plain\", \"iso-8859-1\"], \"passed\": true}, {\"check\": \"nested message parent\", \"actual\": [\"text/plain\", \"us-ascii\"], \"expected\": [\"text/plain\", \"us-ascii\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}