# Random build errors

**URL:** <https://ziggit.dev/t/random-build-errors/5638>\
**Category:** Help\
**Tags:** build-system\
**Created:** [August 16, 2024, 10:51am UTC](https://ziggit.dev/t/random-build-errors/5638 "2024-08-16T10:51:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![finlaydotb](https://ziggit.dev/user_avatar/ziggit.dev/finlaydotb/32/3462_2.png) [@finlaydotb](https://ziggit.dev/u/finlaydotb)\
**Post date:** [August 16, 2024, 10:51am UTC](https://ziggit.dev/t/random-build-errors/5638/1 "2024-08-16T10:51:15Z")

</div>

I randomly get build error of

```zig
error: no field named 'path' in union 'Build.LazyPath'
        .root_source_file = .{ .path = "src/hello.zig" },
                                ^~~~

/.zvm/0.13.0/lib/std/Build.zig:2171:22: note: union declared here
pub const LazyPath = union(enum) {
                     ^ ~~~~

```

My current build script

```zig
const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const lib = b.addStaticLibrary(.{
        .name = "zigzag",
        // In this case the main source file is merely a path, however, in more
        // complicated build scripts, this could be a generated file.
        .root_source_file = b.path("src/root.zig"),
        .target = target,
        .optimize = optimize,
    });

    // This declares intent for the library to be installed into the standard
    // location when the user invokes the "install" step (the default step when
    // running `zig build`).
    b.installArtifact(lib);

    const exe = b.addExecutable(.{
        .name = "zigzag",
        .root_source_file = b.path("src/main.zig"),
        .target = target,
        .optimize = optimize,
    });

    b.installArtifact(exe);

    // test

    const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};
    const exe_unit_tests = b.addTest(.{
        .root_source_file = .{ .path = "src/hello.zig" },
        .target = target,
        .optimize = optimize,
        .filters = test_filters,
    });
    const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
    const test_step = b.step("testx", "Run unit tests");
    test_step.dependOn(&run_exe_unit_tests.step);

    // Runnes
    // const run_exe = b.addRunArtifact(exe);

    // const run_step = b.step("runx", "Runx the application");
    // run_step.dependOn(&run_exe.step);
}

```

sometimes it goes away when I comment out some part of the script and sometimes it does not unless I reset to the default and then revert back to the version I shared.

Any ideas what is going on?

---

<div class="post-metadata">

**Author:** ![tensorush](https://ziggit.dev/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tensorush](https://ziggit.dev/u/tensorush)\
**Post date:** [August 16, 2024, 11:27am UTC](https://ziggit.dev/t/random-build-errors/5638/2 "2024-08-16T11:27:03Z")

</div>

Hi, just change this line:

```zig
        .root_source_file = .{ .path = "src/hello.zig" },

```

to this:

```zig
        .root_source_file = b.path("src/hello.zig"),

```
