{"record":{"id":"49480f277bf8375f","repo":"FoundationAgents/MetaGPT","slug":"please-set-your-config-in-config2-yaml","errorCode":null,"errorMessage":"Please set your config in config2.yaml","messagePattern":"Please set your config in config2\\.yaml","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"metagpt/utils/yaml_model.py","lineNumber":47,"sourceCode":"    def from_yaml_file(cls, file_path: Path) -> \"YamlModel\":\n        \"\"\"Read yaml file and return a YamlModel instance\"\"\"\n        return cls(**cls.read_yaml(file_path))\n\n    def to_yaml_file(self, file_path: Path, encoding: str = \"utf-8\") -> None:\n        \"\"\"Dump YamlModel instance to yaml file\"\"\"\n        with open(file_path, \"w\", encoding=encoding) as file:\n            yaml.dump(self.model_dump(), file)\n\n\nclass YamlModelWithoutDefault(YamlModel):\n    \"\"\"YamlModel without default values\"\"\"\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_not_default_config(cls, values):\n        \"\"\"Check if there is any default config in config2.yaml\"\"\"\n        if any([\"YOUR\" in v for v in values]):\n            raise ValueError(\"Please set your config in config2.yaml\")\n        return values\n","sourceCodeStart":29,"sourceCodeEnd":49,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/utils/yaml_model.py#L29-L49","documentation":"Error \"Please set your config in config2.yaml\" thrown in FoundationAgents/MetaGPT.","triggerScenarios":"Raised by the YamlModelWithoutDefault validator when any parsed config value still contains the placeholder substring 'YOUR' (e.g. 'YOUR_API_KEY'), meaning config2.yaml was copied from the template without real values filled in.","commonSituations":"Running MetaGPT after creating ~/.metagpt/config2.yaml or config/config2.yaml from the template without replacing placeholders such as YOUR_API_KEY with actual credentials.","solutions":["Create a config2.yaml file in the MetaGPT config directory (~/.metagpt or the repo config path) and set the required configuration keys there.","Alternatively pass the configuration directly in code instead of relying on config2.yaml."],"exampleFix":"# Create ~/.metagpt/config2.yaml with your settings, e.g.:\n# llm:\n#   api_type: 'openai'\n#   model: 'gpt-4'\n#   api_key: 'YOUR_KEY'","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}