{"record":{"id":"872fab578f70dd7e","repo":"agentscope-ai/agentscope","slug":"module-name-r-has-no-attribute-name-r","errorCode":null,"errorMessage":"module {__name__!r} has no attribute {name!r}","messagePattern":"module (.+?) has no attribute (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/rag/__init__.py","lineNumber":76,"sourceCode":"    pay the import cost on first access.\n\n    Args:\n        name (`str`):\n            The attribute name requested by the importer.\n\n    Returns:\n        `object`:\n            The resolved attribute value.\n\n    Raises:\n        `AttributeError`:\n            When ``name`` is not exposed by this package.\n    \"\"\"\n    if name == \"run_worker\":\n        from .index_worker import run_worker as _run_worker\n\n        return _run_worker\n    raise AttributeError(f\"module {__name__!r} has no attribute {name!r}\")\n\n\n__all__ = [\n    \"AsyncReadable\",\n    \"BlobStoreBase\",\n    \"CollectionPerKbManager\",\n    \"DimensionPolicy\",\n    \"DimensionPolicyError\",\n    \"DimensionPolicyKind\",\n    \"KnowledgeBaseError\",\n    \"KnowledgeBaseManagerBase\",\n    \"KnowledgeBaseNotFoundError\",\n    \"LocalBlobStore\",\n    \"S3BlobStore\",\n    \"run_worker\",\n]\n","sourceCodeStart":58,"sourceCodeEnd":93,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/rag/__init__.py#L58-L93","documentation":"The agentscope.app.rag package defines a module-level __getattr__ for lazy exports (currently only 'run_worker'). Any other attribute access on the package that is not in __all__ raises this AttributeError. It is the standard Python lazy-import pattern, so seeing it means you imported a name that the package genuinely does not export (or renamed/removed in this version).","triggerScenarios":"Doing 'from agentscope.app.rag import SomeName' or 'agentscope.app.rag.SomeName' where SomeName is not run_worker and not in the package's __all__; common with renamed classes or names that live in submodules (e.g. agentscope.app.rag.blob_store.LocalBlobStore) rather than the top-level package.","commonSituations":"Upgrading agentscope after a RAG API refactor renamed/moved symbols; IDE autocompleting a submodule attribute; copy-pasting imports from older docs or examples.","solutions":["Check agentscope/app/rag/__init__.py's __all__ for the names actually exported and import from there","If the symbol lives in a submodule, import it directly, e.g. from agentscope.app.rag.blob_store import LocalBlobStore","If it was renamed in a release, migrate to the new name from the changelog","For run_worker, the lazy import only works as agentscope.app.rag.run_worker"],"exampleFix":"# before\nfrom agentscope.app.rag import LocalBlobStore  # AttributeError\n\n# after\nfrom agentscope.app.rag.blob_store import LocalBlobStore","handlingStrategy":"type-guard","validationCode":"import agentscope.app.rag as rag\nname = 'run_worker'\nif name not in rag.__all__ and name != 'run_worker':\n    raise ImportError(f'{name} is not exported by agentscope.app.rag')","typeGuard":"import agentscope.app.rag as rag\n\ndef rag_exports(name: str) -> bool:\n    return name in rag.__all__ or name == 'run_worker'","tryCatchPattern":"try:\n    from agentscope.app.rag import run_worker\nexcept AttributeError:\n    # name genuinely not exported; check __all__ or import from submodule\n    raise","preventionTips":["Import from the package's documented __all__ or directly from submodules","After upgrading agentscope, grep the changelog for RAG symbol moves","Prefer explicit submodule imports over star/guess imports"],"tags":["python","import","lazy-import","attributeerror","rag"],"backgroundTag":"module-attribute-not-found","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}