Skip to content

Bug Report: Crash when including a file with @filename #33632

Description

@LittleNyima

Description

When using @filename in opencode to include a file into the context, the program crashes. However, if I move the same file to another directory that contains fewer files and include it again using @filename, it works correctly and does not crash.

This seems to be related to the number of files in the directory, rather than the specific file content.

And this is the trace I got from the command RUST_BACKTRACE=1 RUST_BACKTRACE=full opencode --print-logs 2> opencode.log:

thread '<unnamed>' (91687182) panicked at crates/fff-core/src/simd_path.rs:109:13:
index out of bounds: the len is 32 but the index is 32
stack backtrace:
   0:        0x1673b5574 - <<std[7d7552da0923e8b2]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[4b39a0a778b8475a]::fmt::Display>::fmt
   1:        0x1671cd6cc - core[4b39a0a778b8475a]::fmt::write
   2:        0x1673ba450 - <std[7d7552da0923e8b2]::sys::stdio::unix::Stderr as std[7d7552da0923e8b2]::io::Write>::write_fmt
   3:        0x1673a2528 - std[7d7552da0923e8b2]::panicking::default_hook::{closure#0}
   4:        0x1673aff14 - std[7d7552da0923e8b2]::panicking::default_hook
   5:        0x1673b0274 - std[7d7552da0923e8b2]::panicking::panic_with_hook
   6:        0x1673a25cc - std[7d7552da0923e8b2]::panicking::panic_handler::{closure#0}
   7:        0x167397fb4 - std[7d7552da0923e8b2]::sys::backtrace::__rust_end_short_backtrace::<std[7d7552da0923e8b2]::panicking::panic_handler::{closure#0}, !>
   8:        0x1673a2ac0 - __rustc[8068f81614cfe5c]::rust_begin_unwind
   9:        0x16745b1d0 - core[4b39a0a778b8475a]::panicking::panic_fmt
  10:        0x16745b070 - core[4b39a0a778b8475a]::panicking::panic_bounds_check
  11:        0x167230b84 - fff_search::simd_path::ChunkedString::resolve_ptrs::ha460ee57d06e1a38
  12:        0x16723c7c4 - neo_frizbee::one_shot::matcher::Matcher::match_list_resolved_into::h4457c548d0f2a740
  13:        0x167247ef0 - std::sys::backtrace::__rust_begin_short_backtrace::h870a532013a4fdcc
  14:        0x16725459c - core::ops::function::FnOnce::call_once{{vtable.shim}}::h28dde07c46951f34
  15:        0x1673b4ac0 - <std[7d7552da0923e8b2]::sys::thread::unix::Thread>::new::thread_start
  16:        0x184b7dc58 - __pthread_cond_wait

thread '<unnamed>' (91686599) panicked at /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/neo_frizbee-0.10.2/src/one_shot/parallel.rs:181:40:
called `Result::unwrap()` on an `Err` value: Any { .. }
stack backtrace:
   0:        0x1673b5574 - <<std[7d7552da0923e8b2]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[4b39a0a778b8475a]::fmt::Display>::fmt
   1:        0x1671cd6cc - core[4b39a0a778b8475a]::fmt::write
   2:        0x1673ba450 - <std[7d7552da0923e8b2]::sys::stdio::unix::Stderr as std[7d7552da0923e8b2]::io::Write>::write_fmt
   3:        0x1673a2528 - std[7d7552da0923e8b2]::panicking::default_hook::{closure#0}
   4:        0x1673aff14 - std[7d7552da0923e8b2]::panicking::default_hook
   5:        0x1673b0274 - std[7d7552da0923e8b2]::panicking::panic_with_hook
   6:        0x1673a25cc - std[7d7552da0923e8b2]::panicking::panic_handler::{closure#0}
   7:        0x167397fb4 - std[7d7552da0923e8b2]::sys::backtrace::__rust_end_short_backtrace::<std[7d7552da0923e8b2]::panicking::panic_handler::{closure#0}, !>
   8:        0x1673a2ac0 - __rustc[8068f81614cfe5c]::rust_begin_unwind
   9:        0x16745b1d0 - core[4b39a0a778b8475a]::panicking::panic_fmt
  10:        0x16745b000 - core[4b39a0a778b8475a]::result::unwrap_failed
  11:        0x16723b610 - <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next::h136298e39c4ab7fc
  12:        0x1672262d4 - fff_search::score::match_fuzzy_parts_dirs::h6193336a11dfc129
  13:        0x1671fc6a8 - fff_search::file_picker::FilePicker::fuzzy_search_directories::h1a589445caa449fd
  14:        0x1671f9520 - fff_search::file_picker::FilePicker::fuzzy_search_mixed::h2e376db66adf708c
  15:        0x1671e9318 - _fff_search_mixed
fatal runtime error: failed to initiate panic, error 5, aborting

Plugins

none

OpenCode version

1.17.5

Steps to reproduce

  1. Launch opencode in certain directory of my PC;
  2. Input @ig;
  3. When the letter g is typed, the program crashes.

Screenshot and/or share link

Image

Operating System

macOS 26.5.1 (25F80)

Terminal

/bin/zsh

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions