{"record":{"id":"1f9641852d2506fc","repo":"hiyouga/LlamaFactory","slug":"kernel-config-include-kernels-must-select-at-least","errorCode":null,"errorMessage":"kernel_config.include_kernels must select at least one FLA kernel.","messagePattern":"kernel_config\\.include_kernels must select at least one FLA kernel\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/v1/plugins/model_plugins/kernels/ops/linear_attention/fla.py","lineNumber":75,"sourceCode":"        except ImportError as exc:\n            raise RuntimeError(\"Flash Linear Attention and FSDPTurbo are required for this kernel.\") from exc\n\n    @staticmethod\n    def _apply(**kwargs) -> HFModel:\n        model = kwargs[\"model\"]\n        config = kwargs.get(\"config\") or {}\n        include_kernels = config.get(\"include_kernels\", \"auto\")\n        chunk_size = config.get(\"chunk_size\", 64)\n\n        if include_kernels == \"auto\" or include_kernels is True:\n            selected = list(FLASH_LINEAR_ATTENTION_KERNELS)\n        elif isinstance(include_kernels, str):\n            selected = [name.strip() for name in include_kernels.split(\",\") if name.strip()]\n        else:\n            raise TypeError(\"kernel_config.include_kernels must be 'auto' or a comma-separated string.\")\n\n        if not selected:\n            raise ValueError(\"kernel_config.include_kernels must select at least one FLA kernel.\")\n\n        unsupported = set(selected).difference(FLASH_LINEAR_ATTENTION_KERNELS)\n        if unsupported:\n            raise ValueError(f\"Unsupported Flash Linear Attention kernels: {sorted(unsupported)}\")\n        if isinstance(chunk_size, bool) or not isinstance(chunk_size, int) or chunk_size not in SUPPORTED_CHUNK_SIZES:\n            raise ValueError(f\"chunk_size must be one of {SUPPORTED_CHUNK_SIZES}, got {chunk_size!r}.\")\n\n        from fsdp_turbo.ops.registry import get_op\n        from fsdp_turbo.utils.patch import patch_model_members\n\n        patched = 0\n        named_modules = tuple(model.named_modules())\n        for op_name in selected:\n            module_attribute = FLA_MODULE_ATTRIBUTES[op_name]\n            op = get_op(op_name)\n            configured_op = partial(op, chunk_size=chunk_size) if op_name == CHUNK_GATED_DELTA_RULE else op\n            targets = {\n                f\"{type(module).__module__}.{type(module).__name__}.{module_attribute}\"","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/v1/plugins/model_plugins/kernels/ops/linear_attention/fla.py#L57-L93","documentation":"After parsing `include_kernels`, the FLA plugin verifies that at least one kernel name was actually selected. A string that contains only commas, whitespace, or is empty produces an empty selection list, and the plugin raises a ValueError rather than silently patching nothing.","triggerScenarios":"Passing include_kernels as \"\" (empty string), \"   \", or \",, ,\" — strings that split into zero non-empty names. The strip/filter step removes every token, leaving `selected == []`.","commonSituations":"Empty YAML value that parses to an empty string instead of the default 'auto' (e.g. `include_kernels:` with no value in some loaders), templated configs where a variable interpolates to blank, or hand-edited configs where names were deleted but the key remained.","solutions":["Remove the include_kernels key entirely so the default \"auto\" applies","Or set it to at least one valid FLA kernel name","Audit templated/interpolated configs for blank values reaching kernel_config"],"exampleFix":"# before\nkernel_config:\n  include_kernels: \"\"\n\n# after\nkernel_config:\n  include_kernels: \"auto\"","handlingStrategy":"validation","validationCode":"names = [n.strip() for n in include_kernels.split(\",\") if n.strip()]\nassert names, \"include_kernels selected nothing; use 'auto' or real kernel names\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit include_kernels to get the 'auto' default","Lint configs for blank string values before runs"],"tags":["configuration","validation","kernel-plugin"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}