{"record":{"id":"83f0fed7376ab378","repo":"getzola/zola","slug":"zola-toml-or-config-toml-not-found-in-current-di","errorCode":null,"errorMessage":"zola.toml (or config.toml) not found in current directory or ancestors, current_dir is {}","messagePattern":"zola\\.toml \\(or config\\.toml\\) not found in current directory or ancestors, current_dir is (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":48,"sourceCode":"                    ),\n                );\n                std::process::exit(1);\n            });\n            (root, path.to_path_buf())\n        }\n        None => {\n            // Try zola.toml first, then fall back to config.toml\n            let zola_config = Path::new(\"zola.toml\");\n            let legacy_config = Path::new(\"config.toml\");\n\n            if let Some(root) = dir.ancestors().find(|a| a.join(zola_config).exists()) {\n                (root, zola_config.to_path_buf())\n            } else if let Some(root) = dir.ancestors().find(|a| a.join(legacy_config).exists()) {\n                (root, legacy_config.to_path_buf())\n            } else {\n                messages::unravel_errors(\n                    \"\",\n                    &anyhow!(\n                        \"zola.toml (or config.toml) not found in current directory or ancestors, current_dir is {}\",\n                        dir.display()\n                    ),\n                );\n                std::process::exit(1);\n            }\n        }\n    };\n\n    // if we got here we found root_dir so config file should exist so we could theoretically unwrap safely\n    let config_file_uncanonicalized = root_dir.join(&config_path);\n    let config_file = config_file_uncanonicalized.canonicalize().unwrap_or_else(|e| {\n        messages::unravel_errors(\n            &format!(\"Could not find canonical path of {}\", config_file_uncanonicalized.display()),\n            &e.into(),\n        );\n        std::process::exit(1);\n    });","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/src/main.rs#L30-L66","documentation":"With no explicit --config, get_config_file_path searches the current directory and all ancestors for zola.toml (preferred) then legacy config.toml. If neither is found anywhere up the tree, it reports this error and exits with code 1 — Zola cannot determine the site root.","triggerScenarios":"Running zola build/serve/check outside any Zola site directory and outside all of its parent directories — e.g. from $HOME, a freshly cloned repo that hasn't been created with `zola init`, or a directory where the config was renamed/deleted.","commonSituations":"Opening a terminal in the wrong project directory; a project where config.toml was deleted or renamed; initializing CI before `zola init`; supporting legacy config.toml only on old Zola versions while the project expects the new name.","solutions":["cd into the root of your Zola site (the directory containing zola.toml or config.toml) and re-run the command","Create a site with `zola init my-site` if you haven't got one yet","Add a zola.toml (or legacy config.toml) to the project root if it was accidentally deleted or renamed","Confirm the file name spelling — Zola looks for exactly `zola.toml` or `config.toml`, not variants"],"exampleFix":"// before\n/home/user $ zola build\n// zola.toml (or config.toml) not found...\n// after\n/home/user $ cd ~/sites/my-blog\n/home/user/sites/my-blog $ zola build","handlingStrategy":"validation","validationCode":"// shell: confirm we're in a Zola site before running commands\nif [ ! -f zola.toml ] && [ ! -f config.toml ]; then\n  echo \"Not a Zola site root (no zola.toml/config.toml)\"; exit 1\nfi\nzola build","typeGuard":null,"tryCatchPattern":"// shell\ncd \"$(git rev-parse --show-toplevel)\" && zola build || echo \"No zola.toml/config.toml at repo root — run zola init\"","preventionTips":["Run zola commands from the site root; use `git rev-parse --show-toplevel` to cd first","Never rename config.toml/zola.toml without checking CI scripts","Standardize on zola.toml for new projects to avoid legacy-name confusion"],"tags":["rust","cli","config","startup"],"backgroundTag":"config-file-not-found","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}