Morganamilo/paru · error
section can not be called
Error message
section can not be called {} What it means
When parsing a pacman.conf-style section, a section name that is not one of `options`, `bin`, `env`, an existing pkgbuild repo, and either collides with a reserved name (`local`, `aur`, `pkg`, `base`) or contains a dot is rejected with 'section can not be called {}'. Reserved/malformed names cannot become pkgbuild repos.
Solutions
- Rename the section to avoid reserved names (local, aur, pkg, base) and remove dots, e.g. `[myrepo]` instead of `[my.repo]` or `[base]`
- Register the repo first if it already exists and you intended to reference it
- Use one of the built-in sections `options`, `bin`, or `env` for non-repo configuration
Example fix
// before [my.repo] Server = https://example.com/ // after [myrepo] Server = https://example.com/
Defensive patterns
Strategy: validation
Validate before calling
const RESERVED = new Set(['local', 'aur', 'pkg', 'base', 'options', 'bin', 'env']);
function validate_section(name: string): string | null {
if (RESERVED.has(name)) return `section '${name}' is reserved`;
if (name.includes('.')) return `section name '${name}' must not contain dots`;
return null;
} Try / catch
match parse_config(text) {
Err(e) if e.to_string().contains("section can not be called") => {
eprintln!("{} — rename the section (avoid reserved names and dots)", e);
std::process::exit(1);
}
Err(e) => return Err(e),
Ok(cfg) => apply(cfg),
} Prevention
- Name custom pkgbuild repo sections with simple alphanumeric identifiers
- Never reuse built-in names (local, aur, pkg, base) for repos
- Keep dots out of section names — they collide with repo.name addressing
When it happens
Trigger: Defining a section like `[base]`, `[local]`, `[aur]`, `[pkg]`, or dotted names like `[my.repo]` in the config file, where the name isn't `options`/`bin`/`env` and isn't already a registered pkgbuild repo.
Common situations: Users adding a repo section named like a built-in; using dots in repo names (conflicts with repo.name addressing); typos when creating custom pkgbuild repo sections.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- invalid value ' ' for key ' ', expected
- unknown mode
- no local repo named
- can not find local repo
- key can not contain null bytes
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/4c27f6f56422783f.
Report an issue: GitHub.
Appendix: source
Thrown at src/config.rs:564
pub assume_installed: Vec<String>,
#[default(PkgbuildRepos::new(aur_fetch::Fetch::with_cache_dir("repo")))]
pub pkgbuild_repos: PkgbuildRepos,
}
impl Ini for Config {
type Err = Error;
fn callback(&mut self, cb: Callback) -> Result<(), Self::Err> {
let err = match cb.kind {
CallbackKind::Section(section) => {
self.section = Some(section.to_string());
if !matches!(section, "options" | "bin" | "env")
&& self.pkgbuild_repos.repo(section).is_none()
{
if matches!(section, "local" | "aur" | "pkg" | "base") || section.contains('.')
{
bail!(tr!("section can not be called {}", section));
}
self.pkgbuild_repos.add_repo(section.to_string());
}
Ok(())
}
CallbackKind::Directive(_, key, value) => self.parse_directive(key, value),
};
let filename = cb.filename.unwrap_or("paru.conf");
err.map_err(|e| anyhow!("{}:{}: {}", filename, cb.line_number, e))
}
}
impl Config {
pub fn new() -> Result<Self> {
let cache =
dirs::cache_dir().ok_or_else(|| anyhow!(tr!("failed to find cache directory")))?;
let cache = cache.join("paru");View on GitHub (pinned to 9ac3578807)