Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "data did not match any variant of untagged enum PackageMaintainers at line 2361 column 7" #21

Closed
usmcamp0811 opened this issue Aug 31, 2023 · 5 comments

Comments

@usmcamp0811
Copy link

Saw your flake on FlakeHub and thought I would give it a go. I added it to my config and tried running:

nix2sbom --current-system

and I got the following error:

[00:00:00.000] (7f28fe0877c0) INFO   Getting the derivations from the current system.
[00:00:01.197] (7f28fe0877c0) INFO   Found 10375 derivations
[00:00:01.197] (7f28fe0877c0) INFO   Getting the metadata for packages in the Nix store
Error: "data did not match any variant of untagged enum PackageMaintainers at line 2361 column 7"

I tried some more things and got the same or similar looking errors:

╭─mcamp on butler in ~/code/campground-nvim on master🔥
╰─🚧 nix2sbom -f .#
[00:00:00.000] (7fc8d82b47c0) INFO   Getting the derivations from file .#.
[00:00:02.779] (7fc8d82b47c0) INFO   Found 4344 derivations
[00:00:02.779] (7fc8d82b47c0) INFO   Getting the metadata for packages in the Nix store
Error: "data did not match any variant of untagged enum PackageMaintainers at line 2361 column 7"
╭─mcamp on butler in ~/code/campground-nvim on master🔥
╰─🚧 cd ../vault-secrets 
╭─mcamp on butler in ~/code/vault-secrets on main✔️
╰─🚧 nix2sbom -f .#     
[00:00:00.000] (7f0a885e47c0) INFO   Getting the derivations from file .#.
[00:00:00.448] (7f0a885e47c0) INFO   Found 654 derivations
[00:00:00.448] (7f0a885e47c0) INFO   Getting the metadata for packages in the Nix store
Error: "data did not match any variant of untagged enum PackageMaintainers at line 2361 column 7"

campground-nvim and vault-secrets are flakes of mine, the nvim one is based on nixvim and the other is a simple shell script flake I was playing with the other night.

I very well might be doing something dumb, because I only marginally know what I'm doing. So if I am way out in left field let me know..

@louib
Copy link
Owner

louib commented Sep 9, 2023

@usmcamp0811 thanks for reporting the issue!

This step is fetching the metadata for the packages in your store, which explains why I wasn't able to reproduce locally.
You can generate the metadata information for your Nix store with the following command:

nix-env -q -a --meta --json '.*' > packages-metadata.json

You can then call nix2sbom with the --metadata-path option to use a pre-generated metadata, for example:

nix2sbom -f .# --metadata-path packages-metadata.json

If you could do the following two commands and send me the derivation that is located at line 2361 (or whatever line it will be once you try again), that would help me troubleshooting faster. Thanks a lot!

@usmcamp0811
Copy link
Author

usmcamp0811 commented Sep 9, 2023

I tried running those commands and got:

╭─mcamp on butler in /config on nixos🔥
╰─🚧 nix-env -q -a --meta --json '.*' > packages-metadata.json
╭─mcamp on butler in /config on nixos🔥
╰─🚧 nix2sbom -f .# --metadata-path packages-metadata.json
[00:00:00.000] (7fc99ef0f7c0) INFO   Getting the derivations from file .#.
Error: Custom { kind: UnexpectedEof, error: Error("EOF while parsing a value", line: 1, column: 0) }
╭─mcamp on butler in /config on nixos🔥
╰─🚧 nix2sbom -f .# --metadata-path /config/packages-metadata.json
[00:00:00.000] (7f40b6af07c0) INFO   Getting the derivations from file .#.
Error: Custom { kind: UnexpectedEof, error: Error("EOF while parsing a value", line: 1, column: 0) }
╭─mcamp on butler in /config on nixos🔥
╰─🚧 nix2sbom -f .#butler --metadata-path /config/packages-metadata.json
[00:00:00.000] (7fec1f50b7c0) INFO   Getting the derivations from file .#butler.
Error: Custom { kind: UnexpectedEof, error: Error("EOF while parsing a value", line: 1, column: 0) }

I dunno about uploading that packages-metadata.json its 128MB. If you need it I can figure a place to put it.

if you mean whats at line 2361 in the json then this is whats in that area:

  "nixos.LAStools": {
    "meta": {
      "available": false,
      "broken": false,
      "description": "Software for rapid LiDAR processing",
      "homepage": "http://lastools.org/",
      "insecure": false,
      "license": {
        "deprecated": false,
        "free": false,
        "fullName": "Unfree",
        "redistributable": false,
        "shortName": "unfree"
      },
      "maintainers": [
        {
          "github": "StephenWithPH",
          "githubId": 2990492,
          "name": "StephenWithPH"
        }
      ],
      "name": "LAStools-2.0.2",
      "outputsToInstall": [
        "out"
      ],
      "platforms": [
        "i686-cygwin",
        "x86_64-cygwin",
        "x86_64-darwin",
        "i686-darwin",
        "aarch64-darwin",
        "armv7a-darwin",
        "i686-freebsd13",
        "x86_64-freebsd13",
        "x86_64-solaris",
        "aarch64-linux",
        "armv5tel-linux",
        "armv6l-linux",
        "armv7a-linux",
        "armv7l-linux",
        "i686-linux",
        "loongarch64-linux",
        "m68k-linux",
        "microblaze-linux",
        "microblazeel-linux",
        "mipsel-linux",
        "mips64el-linux",
        "powerpc64-linux",
        "powerpc64le-linux",
        "riscv32-linux",
        "riscv64-linux",
        "s390-linux",
        "s390x-linux",
        "x86_64-linux",
        "aarch64-netbsd",
        "armv6l-netbsd",
        "armv7a-netbsd",
        "armv7l-netbsd",
        "i686-netbsd",
        "m68k-netbsd",
        "mipsel-netbsd",
        "powerpc-netbsd",
        "riscv32-netbsd",
        "riscv64-netbsd",
        "x86_64-netbsd",
        "i686-openbsd",
        "x86_64-openbsd",
        "x86_64-redox"
      ],
      "position": "/nix/store/mirpm2hcfllj98r3rhq9y72r3gj5khnm-nixos-23.05.3071.c540061ac8d7/nixos/pkgs/development/libraries/LAStools/default.nix:27",
      "unfree": true,
      "unsupported": false
    },
    "name": "LAStools-2.0.2",
    "outputName": "out",
    "outputs": {
      "out": null
    },
    "pname": "LAStools",
    "system": "x86_64-linux",
    "version": "2.0.2"
  },

@louib
Copy link
Owner

louib commented Sep 17, 2023

@usmcamp0811 thanks for the snippet! I was able to capture the bug in a unit test and provide a fix in #24.

I'm not sure why you were getting the UnexpectedEof errors when trying to use the --metadata-path path option 🤔 I tried reproducing locally but didn't get that error.

@louib
Copy link
Owner

louib commented Sep 17, 2023

@usmcamp0811 please give it another shot with version louib/nix2sbom/0.1.106+rev-db34541fdf1017060bfaefa60c3b8867c7518aa6, which should be available from Flakehub now.

@louib
Copy link
Owner

louib commented Oct 15, 2023

@usmcamp0811 I'm going to close this one, let me know if you run into the issue again.

@louib louib closed this as completed Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants