{"id":"bacf3b16b06bcb76","repo":"python-poetry/poetry","slug":"no-local-config-file-found","errorCode":null,"errorMessage":"No local config file found","messagePattern":"No local config file found","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/config.py","lineNumber":433,"sourceCode":"                message = (\n                    f\"<c1>{k + key}</c1> = <c2>{json.dumps(raw_val)}</c2>  # {value}\"\n                )\n            else:\n                message = f\"<c1>{k + key}</c1> = <c2>{json.dumps(value)}</c2>\"\n\n            self.line(message)\n\n    def _migrate(self) -> None:\n        from poetry.config.file_config_source import FileConfigSource\n        from poetry.locations import CONFIG_DIR\n        from poetry.toml.file import TOMLFile\n\n        config_file = TOMLFile(CONFIG_DIR / \"config.toml\")\n\n        if self.option(\"local\"):\n            config_file = TOMLFile(self.poetry.file.path.parent / \"poetry.toml\")\n            if not config_file.exists():\n                raise RuntimeError(\"No local config file found\")\n\n        config_source = FileConfigSource(config_file)\n\n        self.io.write_line(\"Checking for required migrations ...\")\n\n        required_migrations = [\n            migration\n            for migration in CONFIG_MIGRATIONS\n            if migration.dry_run(config_source, io=self.io)\n        ]\n\n        if not required_migrations:\n            self.io.write_line(\"Already up to date.\")\n            return\n\n        if not self.io.is_interactive() or self.confirm(\n            \"Proceed with migration?: \", False\n        ):","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/config.py#L415-L451","documentation":"RuntimeError raised in `_migrate` (config.py:430-433) when `poetry config --migrate --local` is run but no `poetry.toml` exists in the project root. The local migration target is `path.parent / 'poetry.toml'`; absence makes migration meaningless.","triggerScenarios":"Running `poetry config --migrate --local` in a project that has never had a local `poetry.toml`.","commonSituations":"Running `--migrate --local` out of habit; expecting `pyproject.toml` to count as the local config (it does not — only `poetry.toml` does); wrong working directory.","solutions":["Drop `--local` to migrate the global config instead: `poetry config --migrate`.","If a local config is intended, create `poetry.toml` first (e.g. `poetry config --local virtualenvs.in-project true`).","Run from the directory that actually contains `poetry.toml`."],"exampleFix":"# before\npoetry config --migrate --local   # no poetry.toml present\n# after\npoetry config --migrate            # migrate global config","handlingStrategy":"validation","validationCode":"from pathlib import Path\nlocal = Path.cwd() / \"poetry.toml\"\nif not local.exists():\n    raise SystemExit(\"no poetry.toml here; drop --local or create one first\")","typeGuard":"def has_local_config(cwd: str | None = None) -> bool:\n    from pathlib import Path\n    return (Path(cwd or \".\") / \"poetry.toml\").exists()","tryCatchPattern":null,"preventionTips":["Reserve `--local` for projects that already use a `poetry.toml`.","Create the file via `poetry config --local <key> <value>` first.","Document whether your project uses global or local config."],"tags":["config","migration","local-config"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}