{"record":{"id":"198d3b94a187cd3a","repo":"diem/diem","slug":"no-initial-command","errorCode":null,"errorMessage":"No initial command","messagePattern":"No initial command","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"language/testing-infra/transactional-test-runner/src/tasks.rs","lineNumber":90,"sourceCode":"        } else if WHITESPACE.is_match(&line) {\n            in_command = false;\n            continue;\n        } else {\n            in_command = false;\n            cur_text.push((line_number, line))\n        }\n    }\n    bucketed_lines.push((cur_commands, cur_text));\n\n    if bucketed_lines.is_empty() {\n        return Ok(vec![]);\n    }\n\n    let mut tasks = vec![];\n    for (number, (commands, text)) in bucketed_lines.into_iter().enumerate() {\n        if commands.is_empty() {\n            assert!(number == 0);\n            bail!(\"No initial command\")\n        }\n\n        let start_line = commands.first().unwrap().0;\n        let command_lines_stop = commands.last().unwrap().0;\n        let mut command_text = \"task \".to_string();\n        for (line_number, text) in commands {\n            assert!(!text.is_empty(), \"{}: {}\", line_number, text);\n            command_text = format!(\"{} {}\", command_text, text);\n        }\n        let command_split = command_text.split_ascii_whitespace().collect::<Vec<_>>();\n        let name_opt = command_split.get(1).map(|s| (*s).to_owned());\n        let command = match Command::from_iter_safe(command_split) {\n            Ok(command) => command,\n            Err(e) => {\n                let mut spit_iter = command_text.split_ascii_whitespace();\n                // skip 'task'\n                spit_iter.next();\n                let help_command = match spit_iter.next() {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/language/testing-infra/transactional-test-runner/src/tasks.rs#L72-L108","documentation":"taskify buckets consecutive non-empty lines of a test file into tasks; a bucket that produced no commands at the very first position means the file starts with a blank/empty command bucket. The harness bails because a task stream must begin with at least one command to attach directives to.","triggerScenarios":"Running taskify on a .move test file whose first bucketed line group contains no parseable commands (empty file, or the first bucket is empty) — the assert!(number == 0) confirms this only fires for the first bucket.","commonSituations":"A test file that begins with blank lines or only comments so the first bucket has zero commands; malformed directive syntax at the top of the file that parses to no commands; accidentally passing an empty or wrong file to taskify.","solutions":["Ensure the test file starts with a valid command directive (e.g. '//# run ...' or '// options ...') and no leading empty bucket","Remove stray blank/comment-only lines at the top of the file so the first bucket contains a command","Verify you passed the correct file path to the test runner"],"exampleFix":"// before\n\n\n//# run 0x1::m::f\n// after (command on the first bucket)\n//# run 0x1::m::f","handlingStrategy":"validation","validationCode":"// Before calling taskify, check the file starts with a command bucket\nlet first_bucket_has_command = lines.iter()\n    .find(|l| !l.trim().is_empty())\n    .map_or(false, |l| l.trim_start().starts_with(\"//#\"));\nassert!(first_bucket_has_command, \"test file must begin with a //# command directive\");","typeGuard":null,"tryCatchPattern":"match taskify(text) {\n    Err(e) if e.to_string() == \"No initial command\" => {\n        bail!(\"Test file is empty or starts without a command directive; add e.g. '//# run ...' at the top\")\n    }\n    other => other,\n}","preventionTips":["Start every .move test file with a directive (//# run, //# init, etc.)","Do not leave blank/comment-only buckets at the very top of the file","Sanity-check the file passed to the runner is the intended non-empty test"],"tags":["move","testing","taskify","parse"],"backgroundTag":"missing-initial-command","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"}