{"record":{"id":"704fabb7d1e0c2b6","repo":"diem/diem","slug":"automatically-building-move-code-failed-need-to-m","errorCode":null,"errorMessage":"Automatically building Move code failed. Need to manually resolve the issue using the CLI","messagePattern":"Automatically building Move code failed\\. Need to manually resolve the issue using the CLI","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"shuffle/genesis/src/lib.rs","lineNumber":82,"sourceCode":"    let diem_root_key_path = node_config_dir.join(\"mint.key\");\n    let serialized_keys = bcs::to_bytes(&root_keys.root_key).unwrap();\n    let mut key_file = std::fs::File::create(&diem_root_key_path).unwrap();\n    key_file.write_all(&serialized_keys).unwrap();\n\n    Ok(validators.pop().unwrap())\n}\n\npub fn build_move_sources() -> Result<()> {\n    // Build the Move code to ensure we get the latest changes in script builders + the genesis WriteSet\n    utils::time_it(\"Building Move code\", || {\n        let output = Command::new(\"df-cli\")\n            .args(&[\"sandbox\", \"publish\"])\n            .current_dir(MOVE_CODE_DIR)\n            .output()\n            .expect(\"Failure building Move code\");\n        if !output.status.success() || !output.stdout.is_empty() || !output.stderr.is_empty() {\n            io::stdout().write_all(&output.stdout).unwrap();\n            panic!(\"Automatically building Move code failed. Need to manually resolve the issue using the CLI\");\n        }\n    });\n    // Hack: remove the Debug module because attempting to publish it in genesis will fail.\n    // The issue is that the module uses native functions that are only included in a VM built with\n    // certain flags enabled.\n    // TODO: better solution for this\n    let debug_module_path = Path::new(MOVE_BYTECODE_DIR);\n    fs::remove_file(debug_module_path.join(\"Debug.mv\"))?;\n\n    // Generate script ABIs\n    utils::time_it(\"Generating script ABIs\", || {\n        release::generate_script_abis(Path::new(COMPILED_SCRIPTS_ABI_DIR))\n    });\n\n    // Generate script builders in Rust\n    utils::time_it(\"Generating Rust script builders\", || {\n        release::generate_script_builder(\n            Path::new(TRANSACTION_BUILDERS_GENERATED_SOURCE_PATH),","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/shuffle/genesis/src/lib.rs#L64-L100","documentation":"A panic raised when the 'df-cli sandbox publish' subprocess ran but did not succeed: its exit status was a failure, or it unexpectedly produced stdout/stderr output (the check in build_move_sources treats any output on a successful publish as invalid). It indicates the Move code could not be compiled automatically and requires manual resolution.","triggerScenarios":"Move sources in MOVE_CODE_DIR have compile errors, dependency conflicts, or df-cli prints any warning/output during sandbox publish, tripping the `!status.success() || !stdout.is_empty() || !stderr.is_empty()` condition.","commonSituations":"Editing Move modules and introducing a compile error, stale build artifacts, VM native-function flag mismatches (as noted by the adjacent Debug-module comment), or CLI emitting deprecation warnings on stdout.","solutions":["Run `df-cli sandbox publish` manually in MOVE_CODE_DIR to see the real compiler errors","Fix the Move source errors it reports","Clear stale build artifacts/cache and rebuild","If only warnings are printed on success, update the CLI or silence the output so the empty-stdout check passes","Temporarily remove problematic modules (e.g. the Debug module with flag-gated natives) before building"],"exampleFix":"// manually reproduce the failure\ncd <repo>/move/code && df-cli sandbox publish\n// then fix e.g.:\n// before: script { use 0x1::Debug; ... }\n// after:  remove the Debug module usage (natives only in flag-enabled VM builds)","handlingStrategy":"retry","validationCode":"# shell: smoke-test the Move build before genesis\ncd <repo>/move/code && df-cli sandbox publish >/dev/null 2>&1 \\\n  || { echo \"Move build failing; fix errors before genesis\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// Rust: run the CLI manually first and surface compiler output\nlet out = Command::new(\"df-cli\").args(&[\"sandbox\",\"publish\"]).current_dir(MOVE_CODE_DIR).output()\n    .expect(\"Failure building Move code\");\nif !out.status.success() {\n    io::stderr().write_all(&out.stderr).unwrap();\n    panic!(\"Move build failed; fix compiler errors above, then rerun\");\n}","preventionTips":["Compile Move sources in CI to catch errors before genesis","Fix or remove flag-gated native modules (e.g. Debug) before building","Clear stale build artifacts after toolchain upgrades","Treat any CLI stdout/stderr on publish as a failure signal and investigate"],"tags":["rust","panic","move","build","compiler"],"backgroundTag":"move-build-failed","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"}