{"record":{"id":"f01dc30a83fa22b9","repo":"twigphp/Twig","slug":"the-list-type-s-does-not-exist-known-types-are-s","errorCode":null,"errorMessage":"The list type \"%s\" does not exist, known types are: \"%s\".","messagePattern":"The list type \"(.+?)\" does not exist, known types are: \"(.+?)\"\\.","errorType":"exception","errorClass":"Twig\\Error\\RuntimeError","httpStatus":null,"severity":"error","filePath":"extra/intl-extra/IntlExtension.php","lineNumber":614,"sourceCode":"        }\n\n        foreach ($textAttrs as $name => $value) {\n            $this->numberFormatters[$hash]->setTextAttribute(self::NUMBER_TEXT_ATTRIBUTES[$name], $value);\n        }\n\n        foreach ($symbols as $name => $value) {\n            $this->numberFormatters[$hash]->setSymbol(self::NUMBER_SYMBOLS[$name], $value);\n        }\n\n        return $this->numberFormatters[$hash];\n    }\n\n    private function createListFormatter(?string $locale, string $type, string $width): \\IntlListFormatter\n    {\n        $listTypes = self::availableListTypes();\n\n        if (!isset($listTypes[$type])) {\n            throw new RuntimeError(\\sprintf('The list type \"%s\" does not exist, known types are: \"%s\".', $type, implode('\", \"', array_keys($listTypes))));\n        }\n\n        $listWidths = self::availableListWidths();\n\n        if (!isset($listWidths[$width])) {\n            throw new RuntimeError(\\sprintf('The list width \"%s\" does not exist, known widths are: \"%s\".', $width, implode('\", \"', array_keys($listWidths))));\n        }\n\n        if (null === $locale) {\n            $locale = \\Locale::getDefault();\n        }\n\n        $listTypeValue = $listTypes[$type];\n        $listWidthValue = $listWidths[$width];\n\n        $hash = $locale.'|'.$listTypeValue.'|'.$listWidthValue;\n\n        if (!isset($this->listFormatters[$hash])) {","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/twigphp/Twig/blob/a414c3a491defb5a60f2fc88ef79ff37c90010cd/extra/intl-extra/IntlExtension.php#L596-L632","documentation":"createListFormatter validates the $type argument (the list connection type, e.g. 'and'/'or') against IntlExtension::availableListTypes(). An unknown type throws this RuntimeError listing the supported list types.","triggerScenarios":"Calling the format_list filter (formatList -> createListFormatter) with a type argument not in availableListTypes() — e.g. 'nor', 'but', or a typo like 'adn' instead of 'and'.","commonSituations":"Assuming arbitrary conjunctions are supported; typos in template arguments; user-supplied list type values passed straight through from config or request input.","solutions":["Use only types listed in the error (keys of availableListTypes(), typically 'and' and 'or')","Fix the type string in the template or PHP call","Validate config/input list types against availableListTypes() before rendering","Default to 'and' when the configured type is unknown"],"exampleFix":"// before\n{{ items|format_list(type='but') }}\n// after\n{{ items|format_list(type='and') }}","handlingStrategy":"validation","validationCode":"if (!isset(IntlExtension::availableListTypes()[$type])) { throw new \\InvalidArgumentException(\"Unknown list type $type\"); }","typeGuard":"function isKnownListType(string $t): bool { return isset(IntlExtension::availableListTypes()[$t]); }","tryCatchPattern":"try { $out = $intl->formatList($strings, $type); } catch (\\Twig\\Error\\RuntimeError $e) { if (str_contains($e->getMessage(), 'list type')) { $out = $intl->formatList($strings, 'and'); } else { throw $e; } }","preventionTips":["Restrict list type choices to 'and'/'or' in UI and config","Validate before rendering templates","Keep default type 'and'"],"tags":["php","intl","list-formatting","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"a414c3a491defb5a60f2fc88ef79ff37c90010cd","analyzedAt":"2026-09-13T15:10:46.849Z","contentChangedAt":"2026-09-13T15:10:46.849Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}