Zheoni / cooklang-chef

A CLI to manage cooklang recipes
MIT License
68 stars 8 forks source link

Error loading default global config file and rust error #18

Closed mubbelsberger closed 9 months ago

mubbelsberger commented 9 months ago

Hello!

With Version 0.8.3-1 i get the following error when running chef list:

Error: Error loading default global config file

Caused by:
    0: Bad TOML data
    1: TOML parse error at line 6, column 1
         |
       6 | [extensions]
         | ^^^^^^^^^^^^
       Unknown extension name

I deleted [extensions] in the configuration file and the list command was functional again.

But when i try chef serve I get the following error and the server wont start:

2024-02-09T22:11:50.984197Z  WARN Config dir `.cooklang` found not in base path. It will be ignored. You may be running the application in the wrong directory.
thread 'main' panicked at /home/jannisf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cooklang-0.13.0/src/parser/block_parser.rs:67:9:
assertion `left == right` failed: Block tokens not parsed. this is a bug
  left: 1
 right: 3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at src/serve/async_index.rs:167:14:
called `Result::unwrap()` on an `Err` value: Error { kind: Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }), paths: ["/home/jannisf/.local/share/Trash/files/home/jannisf/.wine/dosdevices/z:/var/cache/ldconfig"] }

Thank you very much!

Zheoni commented 9 months ago

Hi! Thanks for reporting these issues. The first one probably because the format was slightly updated and the global config file was already written from a previous version. If it now read the global config great! if not, try to delete the cooklang-chef dir. You can get the location of it with chef config --chef. If for some reason still fails:

The second error I don't really know why it's happening. Can you please run chef serve --debug-trace and paste here (or in pastebin or somewhere) the wall of text it will return? Keep in mind that some directories of your system will be there, so don't do it if don't want to. The parser is panicking with some input recipe, which should never happen. So let's try to get which recipe is making it fail to find the issue.

Zheoni commented 9 months ago

Also, in the first line of the error it says that you are not running chef in a folder that directly contains the .cooklang dir. This means you may be using recipes that you don't expect. Maybe because of the issue with the global config the default collection is not set. Running chef config --setup should help.

mubbelsberger commented 9 months ago

Thank you very much for your answer!

FYI I'm using chef on EndeavourOS install via yay from AUR.

After I ran chef config --setup the directory error is fixed. The rest is sill there.

chef serve --debug-trace.txt

I also did this because the computer told me so. :p

[jannisf@t480s ~]$ RUST_BACKTRACE=full chef serve
thread 'main' panicked at /home/jannisf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cooklang-0.13.0/src/parser/block_parser.rs:67:9:
assertion `left == right` failed: Block tokens not parsed. this is a bug
  left: 1
 right: 3
stack backtrace:
   0:     0x5d86c20c1951 - <unknown>
   1:     0x5d86c1e44a30 - <unknown>
   2:     0x5d86c20bdc8d - <unknown>
   3:     0x5d86c20c1735 - <unknown>
   4:     0x5d86c20c2d83 - <unknown>
   5:     0x5d86c20c2ad0 - <unknown>
   6:     0x5d86c20c326b - <unknown>
   7:     0x5d86c20c316e - <unknown>
   8:     0x5d86c20c1e06 - <unknown>
   9:     0x5d86c20c2f12 - <unknown>
  10:     0x5d86c19f23b5 - <unknown>
  11:     0x5d86c19f2861 - <unknown>
  12:     0x5d86c19efc2f - <unknown>
  13:     0x5d86c1e22b21 - <unknown>
  14:     0x5d86c1dcd5ae - <unknown>
  15:     0x5d86c1de242f - <unknown>
  16:     0x5d86c1c379bf - <unknown>
  17:     0x5d86c1b1edec - <unknown>
  18:     0x5d86c1c387a0 - <unknown>
  19:     0x5d86c1c2d812 - <unknown>
  20:     0x5d86c1c2ff93 - <unknown>
  21:     0x5d86c1be1926 - <unknown>
  22:     0x5d86c1b1633b - <unknown>
  23:     0x5d86c1bfda83 - <unknown>
  24:     0x5d86c1b25b5d - <unknown>
  25:     0x5d86c20b5ee5 - <unknown>
  26:     0x5d86c1b25b4e - <unknown>
  27:     0x7bdc828c1cd0 - <unknown>
  28:     0x7bdc828c1d8a - __libc_start_main
  29:     0x5d86c1a0ce35 - <unknown>
  30:                0x0 - <unknown>
Zheoni commented 9 months ago

From that log, chef is indexing your whole home dir... which is not ideal. I will make some changes in the next release to try to warn the user in a clear way.

I see that your recipes are in ./Dokumente/3 Rezepte. You have to run chef from that dir or set it as the default collection with

chef collection set "/home/jannisf/Dokumente/3 Rezepte"

After that, if the panic continues, try to read each recipe individually and see which one panics. You can do that with

chef recipe <PATH to the .cook>

If you find the one that panics paste it here 😅

mubbelsberger commented 9 months ago

I see that your recipes are in ./Dokumente/3 Rezepte.

I' thought I change this during the chef config --setup. Hm.

Ok so I found the error. There were recipes where the Seperator:was missing after the >>. E.g. >> total time: 10 min

From that error message in the first place, I'd never imagined it would be somethink like this. Interestingly it was no Problem with the last version of chef.

Thank you very much for your help!