Hmbown/CodeWhale · error
persistent command allow rules must not be empty
Error message
persistent command allow rules must not be empty
What it means
A persistent allow rule whose command is present but empty (or only whitespace) is meaningless and dangerous — it would match nothing useful or act as a wildcard depending on the matcher. The library rejects empty/whitespace command strings before writing the rule to the permissions config.
Solutions
- Provide the actual command string in `command` before persisting
- Skip persistence entirely when the command input is blank
- If only a path constraint is intended, remove the empty `command` and set `path` instead
Example fix
// before
let rule = PermissionRule { command: Some(input.trim().into()), command_exact: true, .. }; // input was blank
// after
if !input.trim().is_empty() {
let rule = PermissionRule { command: Some(input.trim().into()), command_exact: true, .. };
}
Defensive patterns
Strategy: validation
Validate before calling
fn has_nonempty_command(rule: &PermissionRule) -> bool {
rule.command.as_deref().map_or(true, |c| !c.trim().is_empty())
} Type guard
fn is_blank_command(rule: &PermissionRule) -> bool {
rule.command.as_deref().is_some_and(|c| c.trim().is_empty())
} Try / catch
match config.append_persistent_allow_rules(&rules) {
Err(e) if e.to_string().contains("must not be empty") => {
// filter out rules with blank commands and retry
}
result => result?,
} Prevention
- Skip persistence when a command input trims to empty
- Trim and check command strings before wrapping them in a rule
- Treat blank input as 'no rule' rather than an empty-command rule
When it happens
Trigger: Calling the persistent allow-rule API with `command: Some("")` or `Some(" ")` (whitespace-only) and `command_exact: true`.
Common situations: A UI or CLI passing an unfilled command input through to persistence; trimming logic stripping a command down to empty before the rule is saved; template/stub rules left unfilled in config.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- agent profile tools.posture= would widen permissions; use…
- external credential access is disabled for
- failed to parse permissions at
- Failed to read MCP config
- parallel(): max 1000 items per call
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/7f6d237d3c2db9d9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/config/src/lib.rs:5347
bail!("append_allow_rules only accepts action = \"allow\"");
}
let Some(workspace) = rule
.workspace
.as_deref()
.and_then(codewhale_execpolicy::normalize_workspace_scope)
else {
bail!("persistent allow rules must be scoped to a workspace");
};
if rule.command.is_some() && !rule.command_exact {
bail!("persistent command allow rules must use exact matching");
}
if rule.command.is_none() && rule.path.is_none() {
bail!("persistent allow rules must match an exact command or path");
}
if let Some(command) = rule.command.as_deref()
&& command.trim().is_empty()
{
bail!("persistent command allow rules must not be empty");
}
if let Some(path) = rule.path.as_deref()
&& codewhale_execpolicy::normalize_workspace_relative_path(path, &workspace)
.is_none_or(|path| path.is_empty())
{
bail!("persistent path allow rules must stay within the workspace");
}
}
self.append_permission_rules(rules, PermissionAction::Allow)
}
fn append_permission_rules(
&mut self,
rules: &[ToolAskRule],
expected_action: PermissionAction,
) -> Result<usize> {
if rules.is_empty() {
return Ok(0);View on GitHub (pinned to 73e0f67d83)