{"record":{"id":"339bdf2ca75c03eb","repo":"zylon-ai/private-gpt","slug":"settings-file-not-found-for-profile-profile-s","errorCode":null,"errorMessage":"Settings file not found for profile '{profile}'. Searched in folders: {_settings_folders} with file name '{profile_file_name}'","messagePattern":"Settings file not found for profile '(.+?)'\\. Searched in folders: (.+?) with file name '(.+?)'","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"private_gpt/settings/settings_loader.py","lineNumber":72,"sourceCode":"    else:\n        profile_file_name = f\"settings-{profile}.yaml\"\n\n    config: dict[str, Any] = {}\n    found = False\n    for settings_folder in _settings_folders:\n        path = Path(settings_folder) / profile_file_name\n        if not path.is_file():\n            continue\n        with Path(path).open(\"r\") as f:\n            raw = load_yaml_with_envvars(f)\n        if not isinstance(raw, dict):\n            raise TypeError(f\"Config file has no top-level mapping: {path}\")\n        config = raw\n        found = True\n        break\n\n    if not found:\n        raise FileNotFoundError(\n            f\"Settings file not found for profile '{profile}'. \"\n            f\"Searched in folders: {_settings_folders} with file name '{profile_file_name}'\"\n        )\n\n    return config\n\n\n@typing.no_type_check\ndef discover_models_from_environment(\n    environ: dict[str, Any] = os.environ,\n) -> list[dict[str, Any]]:\n    \"\"\"Discover model configurations from environment variables.\n\n    This function parses environment variables with the pattern:\n    PGPT_MODELS_<MODEL_ID>_<PARAMETER>[__<NESTED_PARAM>]\n\n    Examples:\n        PGPT_MODELS_GPT4_API_KEY=sk-123 ->","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/settings/settings_loader.py#L54-L90","documentation":"Raised by load_settings_from_profile when none of the configured settings folders contain the profile's YAML file. PrivateGPT resolves profiles to file names ('default' -> settings.yaml, 'override' -> settings.override.yaml, other -> settings-<profile>.yaml) and searches every folder in PGPT_SETTINGS_FOLDER (comma-separated, defaulting to the project root). If no candidate file exists anywhere, the profile cannot be loaded and the app aborts during settings bootstrap.","triggerScenarios":"Starting private-gpt (or importing its Settings) when settings.yaml is missing; setting PGPT_PROFILES=prod without creating settings-prod.yaml in any searched folder; setting PGPT_SETTINGS_FOLDER to a wrong or misspelled path; running from a working directory where the default settings folder does not contain settings.yaml; tests importing tests.fixtures which adds the 'test' profile without a settings-test.yaml.","commonSituations":"Fresh clone where the user renamed or deleted settings.yaml; Docker/CI image that does not copy settings files in; a typo in PGPT_SETTINGS_FOLDER or in the profile name passed via PGPT_PROFILES; deploying with a profile file named settings_prod.yaml (underscore) instead of settings-prod.yaml (hyphen).","solutions":["Create settings.yaml (copy settings.sample.yaml if present) in the project root or in a folder listed in the error message","Fix PGPT_SETTINGS_FOLDER so every comma-separated entry is an existing absolute path containing the profile file","Check the profile naming rule: PGPT_PROFILES=myprofile requires settings-myprofile.yaml exactly (hyphen, not underscore)","Verify the running working directory / container WORKDIR matches where the settings files were mounted","If running tests, ensure a settings-test.yaml exists or remove the fixture that injects the 'test' profile"],"exampleFix":"# before\nexport PGPT_PROFILES=prod\n# FileNotFoundError: Settings file not found for profile 'prod' ...\n\n# after: create the correctly named file in a searched folder\ncp settings.yaml settings-prod.yaml\n# or point the loader at the right folder\nexport PGPT_SETTINGS_FOLDER=/app/config","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\ndef resolve_profile_file(profile: str) -> Path:\n    name = (\"settings.yaml\" if profile == \"default\"\n            else \"settings.override.yaml\" if profile == \"override\"\n            else f\"settings-{profile}.yaml\")\n    folders = [f.strip() for f in os.environ.get(\"PGPT_SETTINGS_FOLDER\", \".\").split(\",\") if f.strip()]\n    for folder in folders:\n        p = Path(folder) / name\n        if p.is_file():\n            return p\n    raise SystemExit(f\"missing {name}; searched {folders}\")","typeGuard":"null","tryCatchPattern":"try:\n    cfg = load_settings_from_profile(profile)\nexcept FileNotFoundError as e:\n    # log searched folders from the message, create file or fix PGPT_SETTINGS_FOLDER\n    raise SystemExit(f\"settings bootstrap failed: {e}\") from e","preventionTips":["Commit a settings.sample.yaml and copy it to settings.yaml as a documented setup step","Validate PGPT_SETTINGS_FOLDER entries exist at container startup before importing private_gpt","Use absolute paths for settings folders in Docker/Kubernetes deployments","Automate a preflight check that all PGPT_PROFILES values map to existing files"],"tags":["configuration","yaml","startup","profiles"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}