xai-org/grok-build · error
Not a directory: {path}
Error message
Not a directory: {path} What it means
`cmd_validate` takes a filesystem path, converts it to a PathBuf, and immediately bails with `Not a directory: {path}` if the path exists but is not a directory (or, per `is_dir()`, is not an accessible directory). The validation pipeline (`load_manifest` and `manifest.validate()`) only runs on directory roots containing a plugin manifest.
Source
Thrown at crates/codegen/xai-grok-pager/src/plugin_cmd.rs:683
.as_deref()
.map(|s| format!(" (subdir: {s})"))
.unwrap_or_default();
println!(" {pname}{ver}{sub}");
}
if let Ok(ManifestLoadResult::Found(manifest)) = load_manifest(&repo.path) {
if let Some(ref desc) = manifest.description {
println!(" description: {desc}");
}
print_component_summary(&manifest, &repo.path);
}
Ok(())
}
fn cmd_validate(path: &str) -> Result<()> {
let root = PathBuf::from(path);
if !root.is_dir() {
bail!("Not a directory: {path}");
}
match load_manifest(&root) {
Ok(ManifestLoadResult::Found(manifest)) => {
manifest
.validate()
.map_err(|e| anyhow::anyhow!("Manifest validation failed: {e}"))?;
println!("Plugin manifest is valid.");
println!(" name: {}", manifest.name);
if let Some(ref v) = manifest.version {
println!(" version: {v}");
}
if let Some(ref d) = manifest.description {
println!(" description: {d}");
}
print_component_summary(&manifest, &root);
Ok(())
}
Ok(ManifestLoadResult::NotFound) => {View on GitHub (pinned to bc7f02eddd)
Solutions
- Pass the plugin root directory, not the manifest file: grok plugin validate ./my-plugin
- Verify the path exists and is a directory: test -d <path>
- Fix typos/absolute vs relative path mistakes (use pwd / ls to confirm)
- Check symlink targets resolve to directories
Example fix
# before $ grok plugin validate ./my-plugin/plugin.toml Error: Not a directory: ./my-plugin/plugin.toml # after $ grok plugin validate ./my-plugin
Defensive patterns
Strategy: validation
Validate before calling
fn assert_plugin_root(path: &str) -> Result<(), String> {
let p = std::path::Path::new(path);
if !p.is_dir() {
return Err(format!("'{path}' is not a directory; pass the plugin root containing the manifest"));
}
Ok(())
} Type guard
fn is_dir_path(p: &str) -> bool {
std::path::Path::new(p).is_dir()
} Try / catch
match result {
Err(e) if e.to_string().starts_with("Not a directory") => {
eprintln!("Pass the plugin root directory, not the manifest file.");
}
other => other?,
} Prevention
- Validate the target with test -d before scripting validate
- Never pass the manifest file itself; always its parent directory
- Use absolute paths in CI to avoid cwd surprises
- Resolve symlinks and confirm they point at directories
When it happens
Trigger: `grok plugin validate <path>` where <path> points at a file (e.g. the manifest file itself instead of its containing directory), an empty/typo'd path, or a path whose parent components are not accessible so is_dir() returns false.
Common situations: Passing plugin.toml/manifest file path instead of the plugin root; wrong working directory in scripts; deleted or renamed plugin directory; symlinks to files rather than directories.
Related errors
- no .git file or directory found at {}
- local workspace cwd must exist and be canonicalizable: {}: {
- local workspace cwd must be an existing directory: {}
- {LOCAL_WORKSPACE_HOME_DENIED}
- Failed to create agent config: {e}
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/1f55636694142662.
Report an issue: GitHub.