{"record":{"id":"eb2199c861ab5b68","repo":"the-benchmarker/web-frameworks","slug":"failed-to-parse-app-zl-main","errorCode":null,"errorMessage":"Failed to parse app.zl","messagePattern":"Failed to parse app\\.zl","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust/zeno-rs-axum/src/main.rs","lineNumber":141,"sourceCode":"    engine.register(\n        \"http.post\",\n        Arc::new(move |_, _, node, _| {\n            let raw = node.value.clone().unwrap_or_default().trim().to_string();\n            let clean = if raw.starts_with('\\'') || raw.starts_with('\"') {\n                raw[1..raw.len() - 1].to_string()\n            } else {\n                raw\n            };\n            r_post.lock().unwrap().push((\"POST\".to_string(), clean, node.clone()));\n            Ok(())\n        }),\n        empty_slot_meta(),\n    );\n\n    // Load & Parse app.zl (with compile-time fallback for container runtime)\n    let zl_content = std::fs::read_to_string(\"app.zl\")\n        .unwrap_or_else(|_| include_str!(\"../app.zl\").to_string());\n    let main_node = parse_string(&zl_content, \"app.zl\").expect(\"Failed to parse app.zl\");\n\n    let parent_scope = Scope::new(None);\n    let mut init_ctx = Context::new();\n    let _ = engine.execute(&mut init_ctx, &main_node, &parent_scope);\n\n    // Build Matchit Router\n    let mut route_map: HashMap<String, MethodHandler> = HashMap::new();\n    for (method, path, node) in routes.lock().unwrap().drain(..) {\n        let matchit_path = convert_path_to_matchit(&path);\n        println!(\"Registered route: {} {} -> matchit: {}\", method, path, matchit_path);\n        let entry = route_map\n            .entry(matchit_path)\n            .or_insert(MethodHandler { get: None, post: None });\n        if method == \"GET\" {\n            entry.get = Some(node);\n        } else if method == \"POST\" {\n            entry.post = Some(node);\n        }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/the-benchmarker/web-frameworks/blob/3795a31d724e41cdb87b6e0d3ac941b7bfac3ea2/rust/zeno-rs-axum/src/main.rs#L123-L159","documentation":"zeno-rs-axum's main loads app.zl (from disk with a compile-time include_str! fallback) and parses it via parse_string; on a syntax error the .expect panics with \"Failed to parse app.zl\", preventing the Matchit router from being built and the axum server from starting.","triggerScenarios":"Starting the axum server when the app.zl found in the working directory (or the bundled ../app.zl fallback) is not valid Zeno DSL — parse_string returns Err and expect panics during main's initialization phase.","commonSituations":"Manual edit of app.zl introduced a typo; partial merge left malformed route definitions; a broken app.zl in the runtime working directory overrides the valid baked-in copy; engine/DSL version upgrade changed the accepted grammar.","solutions":["Feed app.zl to the parser or CLI to get the exact syntax error location and fix the DSL","Use git diff on app.zl to find unintended edits or unresolved merge conflict markers","Remove or repair an invalid app.zl in the working directory so it does not shadow the compile-time fallback","Align app.zl with the DSL grammar of the installed engine version after upgrades","Swap expect for explicit error handling that logs the parse diagnostic, making future failures debuggable"],"exampleFix":"// before\nlet main_node = parse_string(&zl_content, \"app.zl\").expect(\"Failed to parse app.zl\");\n\n// after\nlet main_node = match parse_string(&zl_content, \"app.zl\") {\n    Ok(node) => node,\n    Err(e) => {\n        eprintln!(\"app.zl parse error: {e}\");\n        std::process::exit(1);\n    }\n};","handlingStrategy":"validation","validationCode":"// preflight: parse app.zl before booting axum\nlet zl_content = std::fs::read_to_string(\"app.zl\")\n    .unwrap_or_else(|_| include_str!(\"../app.zl\").to_string());\nif let Err(e) = zeno::parse_string(&zl_content, \"app.zl\") {\n    eprintln!(\"app.zl failed to parse; server not started: {e:?}\");\n    std::process::exit(1);\n}","typeGuard":"null","tryCatchPattern":"// catch the parse failure instead of expect-panicking\nlet main_node = parse_string(&zl_content, \"app.zl\")\n    .map_err(|e| { eprintln!(\"app.zl parse error: {e:?}\"); std::process::exit(1); })\n    .unwrap();","preventionTips":["Run parse validation of app.zl in CI on every change","Diff-review app.zl edits like any other source file","Ensure no stale, malformed app.zl exists in the deployment working directory","Re-check app.zl compatibility whenever the zeno engine crate is upgraded","Add an entrypoint script that syntax-checks app.zl before exec'ing the server"],"tags":["rust","axum","parser","startup","dsl"],"backgroundTag":"dsl-parse-failed","analyzedSha":"3795a31d724e41cdb87b6e0d3ac941b7bfac3ea2","analyzedAt":"2026-09-15T02:39:22.409Z","contentChangedAt":"2026-09-15T02:39:22.409Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}