{"record":{"id":"8fa5988da761ab72","repo":"clockworklabs/SpacetimeDB","slug":"module-bindings-path-exists-but-is-not-a-direct","errorCode":null,"errorMessage":"Module bindings path {} exists but is not a directory.","messagePattern":"Module bindings path (.+?) exists but is not a directory\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":605,"sourceCode":"                .and_then(|v| v.as_str())\n        });\n        if let Some(db_name) = db_to_persist\n            && let Some(path) = create_local_spacetime_config_if_missing(&project_dir, db_name)?\n        {\n            println!(\"{} Created {}\", \"✓\".green(), strip_verbatim_prefix(&path).display());\n        }\n    }\n\n    if !module_bindings_dir.exists() {\n        // Create the module bindings directory if it doesn't exist\n        std::fs::create_dir_all(&module_bindings_dir).with_context(|| {\n            format!(\n                \"Failed to create module bindings path {}\",\n                module_bindings_dir.display()\n            )\n        })?;\n    } else if !module_bindings_dir.is_dir() {\n        anyhow::bail!(\n            \"Module bindings path {} exists but is not a directory.\",\n            module_bindings_path.display()\n        );\n    }\n\n    // Check if we need to login to maincloud\n    // Either because --server maincloud was provided, or because any of the publish configs use maincloud\n    let needs_maincloud_login = resolved_server == \"maincloud\"\n        || spacetime_config\n            .map(|c| {\n                c.iter_all_targets().any(|target| {\n                    target\n                        .additional_fields\n                        .get(\"server\")\n                        .and_then(|v| v.as_str())\n                        .map(|s| s == \"maincloud\")\n                        .unwrap_or(false)\n                })","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/3653d2ed498fddbd83b7062aa6bf8970e18635ec/crates/cli/src/subcommands/dev.rs#L587-L623","documentation":"The module bindings destination already exists on disk but is not a directory (a regular file or symlink to a file). Since a bindings output must be a directory that may need to be created, dev/generate refuses to overwrite the file and bails.","triggerScenarios":"`spacetime dev --module-bindings-path bindings` where `bindings` exists as a file; a config path pointing at a file created by another tool.","commonSituations":"A placeholder file created to reserve the name; build artifacts; case-insensitive filesystems where a differently-cased file collides.","solutions":["Delete or rename the conflicting file","Choose a different bindings directory that does not exist as a file"],"exampleFix":"# before\n# $ ls bindings  ->  a file named 'bindings'\nspacetime dev --module-bindings-path bindings\n\n# after\nrm bindings\nspacetime dev --module-bindings-path bindings","handlingStrategy":"validation","validationCode":"// check the bindings destination is absent or a directory\nlet meta = std::fs::metadata(&module_bindings_dir);\nif let Ok(m) = meta {\n    anyhow::ensure!(m.is_dir(), \"{} exists but is not a directory\", module_bindings_dir.display());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reserve output locations with directories, never placeholder files","In scripts, `mkdir -p` the bindings dir before running dev/generate"],"tags":["cli","filesystem","bindings","dev"],"backgroundTag":"path-conflicts-with-file","analyzedSha":"3653d2ed498fddbd83b7062aa6bf8970e18635ec","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}