mufeedvh / code2prompt

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.
MIT License
1.45k stars 77 forks source link

Panic occurred when running code2prompt with specific arguments #6

Closed slavakurilyak closed 5 months ago

slavakurilyak commented 5 months ago

Description

I encountered a panic when running code2prompt with the following command: RUST_BACKTRACE=full code2prompt .

Error Message

RUST_BACKTRACE=full code2prompt .
▹▹▹▹▸ Done!                                                                                                                                                                     2024-03-18 19:38:56.031 code2prompt[56653:3892444] -[NSPasteboard _setData:forType:index:usesPboardTypes:] returns false. Type: public.utf8-plain-text, index: 0, object class: __NSCFString.
thread 'main' panicked at /Users/slava/.cargo/registry/src/index.crates.io-6f17d22bba15001f/code2prompt-1.0.0/src/main.rs:142:50:
Failed to copy output to clipboard: "NSPasteboard#writeObjects: returned false"
stack backtrace:
   0:        0x10ec08fed - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbd71adb7a72f4105
   1:        0x10ea96323 - core::fmt::write::h30346430340bc336
   2:        0x10ec06962 - std::io::Write::write_fmt::heb3d6316c565d5b1
   3:        0x10ec08d79 - std::sys_common::backtrace::print::h67e51ff2e3d5cfbd
   4:        0x10ec0a0a5 - std::panicking::default_hook::{{closure}}::hc666c9a55318d1f1
   5:        0x10ec09e0c - std::panicking::default_hook::hf980b1da49948523
   6:        0x10ec0a73f - std::panicking::rust_panic_with_hook::h683bce980186bbbe
   7:        0x10ec0a4d4 - std::panicking::begin_panic_handler::{{closure}}::ha6dbd11ba0ec8af1
   8:        0x10ec094e9 - std::sys_common::backtrace::__rust_end_short_backtrace::h889430bddc786c98
   9:        0x10ec0a232 - _rust_begin_unwind
  10:        0x10ec287c5 - core::panicking::panic_fmt::hff768cef35397791
  11:        0x10ec28ca5 - core::result::unwrap_failed::h951d84d71b0bada2
  12:        0x10ea8804a - code2prompt::main::h2d635b437be76536
  13:        0x10ea75306 - std::sys_common::backtrace::__rust_begin_short_backtrace::hddd69f0893274fa7
  14:        0x10ea7544c - std::rt::lang_start::{{closure}}::h0f70ef5c3efad0b4
  15:        0x10ec000cd - std::rt::lang_start_internal::hba631f1493ca29ca
  16:        0x10ea8a82c - _main
[1]    56653 abort      RUST_BACKTRACE=full code2prompt

Steps to Reproduce

  1. Run the command: RUST_BACKTRACE=full code2prompt .
  2. Observe the panic and stack trace.

Additional Context

Expected Behavior

The command should execute without panicking.

Actual Behavior

The command panics with the error message: "Failed to copy output to clipboard: \"NSPasteboard#writeObjects: returned false\""

mufeedvh commented 5 months ago

Clipboard has a size limit, hence the panic.