zylon-ai/private-gpt · critical · FileNotFoundError
Settings file not found for profile '{profile}'. Searched in
Error message
Settings file not found for profile '{profile}'. Searched in folders: {_settings_folders} with file name '{profile_file_name}' What it means
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.
Source
Thrown at private_gpt/settings/settings_loader.py:72
else:
profile_file_name = f"settings-{profile}.yaml"
config: dict[str, Any] = {}
found = False
for settings_folder in _settings_folders:
path = Path(settings_folder) / profile_file_name
if not path.is_file():
continue
with Path(path).open("r") as f:
raw = load_yaml_with_envvars(f)
if not isinstance(raw, dict):
raise TypeError(f"Config file has no top-level mapping: {path}")
config = raw
found = True
break
if not found:
raise FileNotFoundError(
f"Settings file not found for profile '{profile}'. "
f"Searched in folders: {_settings_folders} with file name '{profile_file_name}'"
)
return config
@typing.no_type_check
def discover_models_from_environment(
environ: dict[str, Any] = os.environ,
) -> list[dict[str, Any]]:
"""Discover model configurations from environment variables.
This function parses environment variables with the pattern:
PGPT_MODELS_<MODEL_ID>_<PARAMETER>[__<NESTED_PARAM>]
Examples:
PGPT_MODELS_GPT4_API_KEY=sk-123 ->View on GitHub (pinned to 4a030776a3)
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
Example fix
# before export PGPT_PROFILES=prod # FileNotFoundError: Settings file not found for profile 'prod' ... # after: create the correctly named file in a searched folder cp settings.yaml settings-prod.yaml # or point the loader at the right folder export PGPT_SETTINGS_FOLDER=/app/config
Defensive patterns
Strategy: validation
Validate before calling
import os
from pathlib import Path
def resolve_profile_file(profile: str) -> Path:
name = ("settings.yaml" if profile == "default"
else "settings.override.yaml" if profile == "override"
else f"settings-{profile}.yaml")
folders = [f.strip() for f in os.environ.get("PGPT_SETTINGS_FOLDER", ".").split(",") if f.strip()]
for folder in folders:
p = Path(folder) / name
if p.is_file():
return p
raise SystemExit(f"missing {name}; searched {folders}") Type guard
null
Try / catch
try:
cfg = load_settings_from_profile(profile)
except FileNotFoundError as e:
# log searched folders from the message, create file or fix PGPT_SETTINGS_FOLDER
raise SystemExit(f"settings bootstrap failed: {e}") from e Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Default model '{self._default_model_id}' not found in regist
- Config file has no top-level mapping: {path}
- Environment variable {env_var} is not set and not default wa
- Default LLM model '{model_id}' could not be initialized: {e}
- No model specified and no models are configured
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/339bdf2ca75c03eb.
Report an issue: GitHub.