{"record":{"id":"b3d60ee9635da0fe","repo":"agentscope-ai/agentscope","slug":"agentscope-worker-bootstrap-must-be-in-module-att","errorCode":null,"errorMessage":"AGENTSCOPE_WORKER_BOOTSTRAP must be in 'module:attr' form, got {dotted!r}.","messagePattern":"AGENTSCOPE_WORKER_BOOTSTRAP must be in 'module:attr' form, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/rag/index_worker/__main__.py","lineNumber":71,"sourceCode":"def _resolve(dotted: str) -> Callable[[], dict[str, Any]]:\n    \"\"\"Import ``module:attribute`` and return the attribute.\n\n    Args:\n        dotted (`str`):\n            A ``module:attribute`` reference; must contain a colon.\n\n    Returns:\n        `Callable[[], dict[str, Any]]`:\n            The resolved attribute — expected to be a zero-arg\n            callable that returns the kwargs dict for\n            :func:`run_worker`.\n\n    Raises:\n        `ValueError`:\n            When ``dotted`` does not contain a colon.\n    \"\"\"\n    if \":\" not in dotted:\n        raise ValueError(\n            f\"AGENTSCOPE_WORKER_BOOTSTRAP must be in 'module:attr' \"\n            f\"form, got {dotted!r}.\",\n        )\n    module_name, _, attr = dotted.partition(\":\")\n    module = importlib.import_module(module_name)\n    return getattr(module, attr)\n\n\ndef main() -> None:\n    \"\"\"Resolve the bootstrap callable from the environment and run the worker.\n\n    Reads ``AGENTSCOPE_WORKER_BOOTSTRAP`` (``module:attr`` form),\n    imports the target, calls it for the kwargs dict, and forwards\n    them to :func:`run_worker`.  Exits with code ``2`` when the\n    environment variable is missing — the deployment must supply it\n    because backend selection is a deployment concern.\n    \"\"\"\n    logging.basicConfig(","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/rag/index_worker/__main__.py#L53-L89","documentation":"The RAG index worker entrypoint resolves the AGENTSCOPE_WORKER_BOOTSTRAP env var, which must be a 'module:attr' dotted path (e.g. 'myapp.workers:bootstrap'). If the string contains no colon, _resolve raises ValueError before attempting the import. This is the standard setuptools-style entry-point format.","triggerScenarios":"Running python -m agentscope.app.rag.index_worker with AGENTSCOPE_WORKER_BOOTSTRAP set to 'myapp.workers.bootstrap' (dots instead of colon), 'bootstrap', or empty/whitespace-mangled values.","commonSituations":"Copy-pasting a Python import path instead of an entry-point spec in docker-compose/k8s env blocks; shell quoting that strips the colon; .env file typos; migrating from a config format that used plain module paths.","solutions":["Set the var in 'module:attr' form: AGENTSCOPE_WORKER_BOOTSTRAP='myapp.workers:bootstrap'","Verify with: echo \"$AGENTSCOPE_WORKER_BOOTSTRAP\" that the colon survived shell/env-file quoting","Ensure the target module is importable and the attribute exists (the next step will importlib.import_module it)","Document the exact format next to the variable in your deployment manifests"],"exampleFix":"# before\nENV AGENTSCOPE_WORKER_BOOTSTRAP=myapp.workers.bootstrap  # ValueError\n\n# after\nENV AGENTSCOPE_WORKER_BOOTSTRAP=myapp.workers:bootstrap","handlingStrategy":"validation","validationCode":"def valid_bootstrap(spec: str) -> bool:\n    return ':' in spec and all(part.strip() for part in spec.split(':', 1))\n\nimport os\nspec = os.environ['AGENTSCOPE_WORKER_BOOTSTRAP']\nassert valid_bootstrap(spec), f\"must be 'module:attr', got {spec!r}\"","typeGuard":"null","tryCatchPattern":"try:\n    bootstrap = _resolve(spec)\nexcept ValueError as e:\n    raise SystemExit(f'Bad AGENTSCOPE_WORKER_BOOTSTRAP: {e}') from e","preventionTips":["Use 'module:attr' entry-point format everywhere in env/CI files","Echo the env var in deploy scripts to catch quoting/typo issues","Add startup validation before spawning workers"],"tags":["rag","worker","env-var","entrypoint","configuration"],"backgroundTag":"invalid-env-var-value","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}