{"record":{"id":"b1f775a4f3ac898f","repo":"xai-org/x-algorithm","slug":"no-task-generator-registered-for-type-cfg-type-r","errorCode":null,"errorMessage":"No task generator registered for type {cfg.type!r}. Registered: {sorted(_REGISTRY)}","messagePattern":"No task generator registered for type (.+?)\\. Registered: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"grox/core/generators/registry.py","lineNumber":29,"sourceCode":"        )\n    if not cls.TASK_GENERATOR_TYPE:\n        raise ValueError(\n            f\"{cls.__name__} must set TASK_GENERATOR_TYPE to be registered\"\n        )\n    key = cls.TASK_GENERATOR_TYPE\n    existing = _REGISTRY.get(key)\n    if existing is not None and existing is not cls:\n        raise ValueError(\n            f\"Duplicate generator registration for {key!r}: {existing.__name__} vs {cls.__name__}\"\n        )\n    _REGISTRY[key] = cls\n    return cls\n\n\ndef build(cfg: TaskGeneratorConfig) -> TaskGenerator:\n    cls = _REGISTRY.get(cfg.type)\n    if cls is None:\n        raise ValueError(\n            f\"No task generator registered for type {cfg.type!r}. Registered: {sorted(_REGISTRY)}\"\n        )\n    return cls.from_config(cfg)\n\n\ndef registered_types() -> set[str]:\n    return set(_REGISTRY)\n","sourceCodeStart":11,"sourceCodeEnd":37,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/grox/core/generators/registry.py#L11-L37","documentation":"build(cfg) resolves a TaskGeneratorConfig to a registered class via cfg.type. If no class was registered under that type string, there is no way to construct the generator, so it raises ValueError listing all registered types to aid diagnosis.","triggerScenarios":"Calling registry.build with a TaskGeneratorConfig whose type string doesn't match any registered TASK_GENERATOR_TYPE; typo in config; generator module never imported (so its @register_task_generator never ran).","commonSituations":"Config file references a generator from a module that isn't imported/installed; renaming a generator's type without updating configs; typos or casing mismatches in the type string; plugin module not loaded in the entry point.","solutions":["Import the module that defines (and decorates) the generator before calling build so registration happens.","Fix the type string in the config to exactly match TASK_GENERATOR_TYPE (the error message lists valid values).","Ensure the value's case/whitespace matches — no stripping is done.","If the generator lives in a plugin package, verify the package is installed and its import side effects run."],"exampleFix":"# before\ncfg = TaskGeneratorConfig(type=\"task_gen\")\ngen = build(cfg)  # registry has \"task_generator\"\n\n# after\nimport mypkg.generators.my_gen  # triggers @register_task_generator\ncfg = TaskGeneratorConfig(type=\"my_gen\")\ngen = build(cfg)","handlingStrategy":"validation","validationCode":"from grox.core.generators.registry import registered_types\n\nif cfg.type not in registered_types():\n    raise ValueError(f\"unknown generator {cfg.type}; known: {registered_types()}\")\nimport mypkg.generators  # ensure registrations ran","typeGuard":"def config_type_is_registered(cfg) -> bool:\n    from grox.core.generators.registry import registered_types\n    return cfg.type in registered_types()","tryCatchPattern":"try:\n    gen = build(cfg)\nexcept ValueError as e:\n    if \"No task generator registered\" in str(e):\n        import mypkg.generators  # late import to register\n        gen = build(cfg)\n    else:\n        raise","preventionTips":["Import all generator modules once at app startup before building configs.","Validate config type strings against registered_types() at config load time.","Add a smoke test that every config-referenced type is registered."],"tags":["python","registry","configuration","lookup-failed"],"backgroundTag":"unknown-registry-key","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}