{"record":{"id":"2a116d3e8a0e549e","repo":"diem/diem","slug":"can-t-resolve-module-at","errorCode":null,"errorMessage":"Can't resolve module at {:?}","messagePattern":"Can't resolve module at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"language/tools/move-cli/src/sandbox/commands/generate.rs","lineNumber":40,"sourceCode":"            // Generate for one struct\n            let type_params = type_params_opt.as_ref().unwrap().to_vec(); // always Some if struct_opt is\n            let name = Identifier::new(struct_.as_str())?;\n            let struct_tag = StructTag {\n                address: *module_id.address(),\n                module: module_id.name().to_owned(),\n                name,\n                type_params,\n            };\n            let layout = StructLayoutBuilder::build_with_fields(&struct_tag, state)?;\n            // save to disk\n            state.save_layout_yaml(struct_tag, &layout)?;\n            println!(\"{}\", layout);\n        } else {\n            unimplemented!(\"Generating layout for all structs in a module. Use the --module and --struct options\")\n        }\n        Ok(())\n    } else {\n        bail!(\"Can't resolve module at {:?}\", path)\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":43,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/language/tools/move-cli/src/sandbox/commands/generate.rs#L22-L43","documentation":"`move generate struct-layouts` first resolves the package/module path to a compiled module via the Move build/resolve session. When the module cannot be resolved at the given path, the command bails with this message. It means the path doesn't point at a resolvable Move package/module that the build system can compile.","triggerScenarios":"Running `move generate struct-layouts` with a --path that is not a Move package root, has no Move.toml, contains compile errors, or names a module that doesn't exist in the package.","commonSituations":"Running the command from the wrong working directory; missing or malformed Move.toml; typo in the module path; package fails to compile so no resolved module is produced.","solutions":["Run from (or pass --path to) the Move package root containing a valid Move.toml.","Verify the package compiles first with `move build`; fix any compile errors reported.","Confirm the module name passed via --module exists in the package sources.","Check Move.toml dependencies resolve (run `move build` and inspect errors)."],"exampleFix":"// before\n$ move generate struct-layouts --path ./scripts --module 0x1::account --struct Account\nCan't resolve module at \"./scripts\"\n\n// after: point at the package root\n$ cd my_pkg && move generate struct-layouts --path . --module 0x1::account --struct Account","handlingStrategy":"validation","validationCode":"// Verify path is a Move package root before generating layouts\nif !path.join(\"Move.toml\").exists() {\n    fatal(\"--path must point at a Move package containing Move.toml\");\n}\nrun(\"move build\").expect(\"package must compile before layout generation\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run generate commands from the package root","Run `move build` first to catch resolution/compile errors","Confirm module names with source files under sources/"],"tags":["move","cli","resolution","path"],"backgroundTag":"module-not-found","analyzedSha":"fc4714a8ea273b6efe8b13dbce72ea60aad9a16c","analyzedAt":"2026-09-04T21:07:05.890Z","contentChangedAt":"2026-09-04T21:07:05.890Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}