Skip to content

Conversation

@jamadeo
Copy link
Collaborator

@jamadeo jamadeo commented Oct 16, 2025

fixes #5197

@p5
Copy link

p5 commented Oct 16, 2025

This didn't seem to help my issue - still receiving the "Session not found" error on a build of 6aae3bb:

thread 'main' panicked at /workspaces/goose/crates/goose-cli/src/session/mod.rs:135:18:
called `Result::unwrap()` on an `Err` value: Session not found

Stack backtrace:
   0: anyhow::error::<impl anyhow::Error>::msg
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.99/src/backtrace.rs:27:14
   1: anyhow::__private::format_err
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.99/src/lib.rs:695:13
   2: goose::session::session_manager::SessionStorage::get_session::{{closure}}::{{closure}}
             at ./crates/goose/src/session/session_manager.rs:671:24
   3: core::option::Option<T>::ok_or_else
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1308:25
   4: goose::session::session_manager::SessionStorage::get_session::{{closure}}
             at ./crates/goose/src/session/session_manager.rs:658:27
   5: goose::session::session_manager::SessionManager::get_session::{{closure}}
             at ./crates/goose/src/session/session_manager.rs:180:14
   6: goose_cli::session::CliSession::new::{{closure}}
             at ./crates/goose-cli/src/session/mod.rs:133:18
   7: goose_cli::session::builder::build_session::{{closure}}
             at ./crates/goose-cli/src/session/builder.rs:469:6
   8: goose_cli::cli::cli::{{closure}}
             at ./crates/goose-cli/src/cli.rs:1273:18
   9: goose::main::{{closure}}
             at ./crates/goose-cli/src/main.rs:10:24
  10: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:124:9
  11: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/park.rs:284:63
  12: tokio::runtime::coop::with_budget
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/coop.rs:107:5
  13: tokio::runtime::coop::budget
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/coop.rs:73:5
  14: tokio::runtime::park::CachedParkThread::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/park.rs:284:31
  15: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/context/blocking.rs:66:9
  16: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/scheduler/multi_thread/mod.rs:87:13
  17: tokio::runtime::context::runtime::enter_runtime
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/context/runtime.rs:65:16
  18: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/scheduler/multi_thread/mod.rs:86:9
  19: tokio::runtime::runtime::Runtime::block_on_inner
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/runtime.rs:370:45
  20: tokio::runtime::runtime::Runtime::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/runtime.rs:340:13
  21: goose::main
             at ./crates/goose-cli/src/main.rs:17:5
  22: core::ops::function::FnOnce::call_once
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  23: std::sys::backtrace::__rust_begin_short_backtrace
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18
  24: std::rt::lang_start::{{closure}}
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:199:18
  25: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/core/src/ops/function.rs:284:13
  26: std::panicking::try::do_call
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panicking.rs:589:40
  27: std::panicking::try
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panicking.rs:552:19
  28: std::panic::catch_unwind
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panic.rs:359:14
  29: std::rt::lang_start_internal::{{closure}}
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/rt.rs:168:24
  30: std::panicking::try::do_call
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panicking.rs:589:40
  31: std::panicking::try
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panicking.rs:552:19
  32: std::panic::catch_unwind
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panic.rs:359:14
  33: std::rt::lang_start_internal
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/rt.rs:164:5
  34: std::rt::lang_start
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:198:5
  35: main
  36: <unknown>
  37: __libc_start_main
  38: _start
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/core/src/panicking.rs:75:14
   2: core::result::unwrap_failed
             at /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/core/src/result.rs:1732:5
   3: core::result::Result<T,E>::unwrap
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1137:23
   4: goose_cli::session::CliSession::new::{{closure}}
             at ./crates/goose-cli/src/session/mod.rs:132:13
   5: goose_cli::session::builder::build_session::{{closure}}
             at ./crates/goose-cli/src/session/builder.rs:469:6
   6: goose_cli::cli::cli::{{closure}}
             at ./crates/goose-cli/src/cli.rs:1273:18
   7: goose::main::{{closure}}
             at ./crates/goose-cli/src/main.rs:10:24
   8: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:124:9
   9: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/park.rs:284:63
  10: tokio::runtime::coop::with_budget
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/coop.rs:107:5
  11: tokio::runtime::coop::budget
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/coop.rs:73:5
  12: tokio::runtime::park::CachedParkThread::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/park.rs:284:31
  13: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/context/blocking.rs:66:9
  14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/scheduler/multi_thread/mod.rs:87:13
  15: tokio::runtime::context::runtime::enter_runtime
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/context/runtime.rs:65:16
  16: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/scheduler/multi_thread/mod.rs:86:9
  17: tokio::runtime::runtime::Runtime::block_on_inner
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/runtime.rs:370:45
  18: tokio::runtime::runtime::Runtime::block_on
             at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.1/src/runtime/runtime.rs:340:13
  19: goose::main
             at ./crates/goose-cli/src/main.rs:17:5
  20: core::ops::function::FnOnce::call_once
             at /usr/local/rustup/toolchains/1.88.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@jamadeo jamadeo requested a review from DOsinga October 16, 2025 14:39
@jamadeo
Copy link
Collaborator Author

jamadeo commented Oct 16, 2025

@p5 sorry, yeah, that also failed my test. Try with 7c6bfc1? that one does seem to fix it for me

@p5
Copy link

p5 commented Oct 16, 2025

@p5 sorry, yeah, that also failed my test. Try with 7c6bfc1? that one does seem to fix it for me

Perfect! That one does work! 🙌

vscode ➜ /workspaces/goose (jackamadeo/session-create-race) $ rm -rf ~/.local/share/goose/
vscode ➜ /workspaces/goose (jackamadeo/session-create-race) $ ./target/debug/goose session 
starting session | provider: github_copilot model: grok-code-fast-1
    session id: 20251016_1
    working directory: /workspaces/goose

goose is running! Enter your instructions, or try asking what goose can do.

Context: ○○○○○○○○○○ 0% (0/256000 tokens)
( O)> Press Enter to send, Ctrl-J for new line
Closing session. Session ID: 20251016_1
vscode ➜ /workspaces/goose (jackamadeo/session-create-race) $ git rev-parse --short HEAD
7c6bfc190db

Thank you!

@jamadeo
Copy link
Collaborator Author

jamadeo commented Oct 16, 2025

@p5 this appears to be due to our use of WAL mode for the sqlite database. It also shows up on linux but not macos, and most of goose development happens on macos, so it wasn't caught before.

This change adds a forced checkpoint to sync the WAL to the database file so subsequent reads see the new data. It's a bit of a band-aid solution, and it may be that goose is better off without WAL: #5203 to explore that.

Thanks for your report and testing!

@p5
Copy link

p5 commented Oct 16, 2025

@p5 this appears to be due to our use of WAL mode for the sqlite database. It also shows up on linux but not macos, and most of goose development happens on macos, so it wasn't caught before.

This change adds a forced checkpoint to sync the WAL to the database file so subsequent reads see the new data. It's a bit of a band-aid solution, and it may be that goose is better off without WAL: #5203 to explore that.

Thanks for your report and testing!

That makes complete sense, thank you for explaining!

@jamadeo jamadeo changed the title CliSession::new async force WAL sync after session create Oct 16, 2025
@jamadeo jamadeo merged commit 6c25600 into main Oct 16, 2025
11 checks passed
@jamadeo jamadeo deleted the jackamadeo/session-create-race branch October 16, 2025 15:00
wpfleger96 added a commit to wpfleger96/goose that referenced this pull request Oct 16, 2025
* main:
  Blog: Best Practices for Prompt Engineering with goose (block#5204)
  force WAL sync after session create (block#5202)
  Feat: goose Apify MCP integration docs (block#5047)
  feat: enhance goose to search sessions for easy recall (block#5177)
  Skip hidden & real format (block#5194)
  docs: Hacktoberfest blog submission - Best Practices for Using Goose in Enterprise Environments by Anudhyan Datta. (block#5184)
  docs: prompt injection detection (block#5193)
  Fix mcp large response race condition (block#5065)
@alexhancock alexhancock mentioned this pull request Oct 17, 2025
michaelneale added a commit that referenced this pull request Oct 17, 2025
* main: (119 commits)
  Break compaction back into check_ and do_ compaction (#5212)
  fix: revert built app name to uppercase Goose (#5206)
  feat: add Code Documentation Generator recipe (#5121) (#5125)
  Revert "feat: enhance goose to search sessions for easy recall (#5177)" (#5209)
  Blog: Best Practices for Prompt Engineering with goose (#5204)
  force WAL sync after session create (#5202)
  Feat: goose Apify MCP integration docs (#5047)
  feat: enhance goose to search sessions for easy recall (#5177)
  Skip hidden & real format (#5194)
  docs: Hacktoberfest blog submission - Best Practices for Using Goose in Enterprise Environments by Anudhyan Datta. (#5184)
  docs: prompt injection detection (#5193)
  Fix mcp large response race condition (#5065)
  Compaction overhaul (#5186)
  fix: #3960 better approach to input schema for dynamic task params (#5189)
  used recipe id or deeplink to start agent (#5154)
  [docs] Add Blog Post: "Designing AI for Users, Not Just LLMs" (#5190)
  docs: update cognee, jetbrains, mbot extensions config (#5172)
  Minimally disable subagents when not in autonomous model (#5149)
  Fix provider sort (#5188)
  blog: Getting Started with Goose on Windows (#5156)
  ...
michaelneale added a commit that referenced this pull request Oct 17, 2025
* main: (143 commits)
  Break compaction back into check_ and do_ compaction (#5212)
  fix: revert built app name to uppercase Goose (#5206)
  feat: add Code Documentation Generator recipe (#5121) (#5125)
  Revert "feat: enhance goose to search sessions for easy recall (#5177)" (#5209)
  Blog: Best Practices for Prompt Engineering with goose (#5204)
  force WAL sync after session create (#5202)
  Feat: goose Apify MCP integration docs (#5047)
  feat: enhance goose to search sessions for easy recall (#5177)
  Skip hidden & real format (#5194)
  docs: Hacktoberfest blog submission - Best Practices for Using Goose in Enterprise Environments by Anudhyan Datta. (#5184)
  docs: prompt injection detection (#5193)
  Fix mcp large response race condition (#5065)
  Compaction overhaul (#5186)
  fix: #3960 better approach to input schema for dynamic task params (#5189)
  used recipe id or deeplink to start agent (#5154)
  [docs] Add Blog Post: "Designing AI for Users, Not Just LLMs" (#5190)
  docs: update cognee, jetbrains, mbot extensions config (#5172)
  Minimally disable subagents when not in autonomous model (#5149)
  Fix provider sort (#5188)
  blog: Getting Started with Goose on Windows (#5156)
  ...
zanesq added a commit that referenced this pull request Oct 17, 2025
* 'main' of github.com:block/goose: (22 commits)
  Rewrite extension management tools (#5057)
  fix: re-sync package-lock.json (#5235)
  docs: Hacktoberfest MCP youtube short entry to community-content.json (#5150)
  feat: add schedule button to recipe entries (#5217)
  Autocompact threshold UI cleanup (#5232)
  fix: correct schema for openai tools (#5229)
  Break compaction back into check_ and do_ compaction (#5212)
  fix: revert built app name to uppercase Goose (#5206)
  feat: add Code Documentation Generator recipe (#5121) (#5125)
  Revert "feat: enhance goose to search sessions for easy recall (#5177)" (#5209)
  Blog: Best Practices for Prompt Engineering with goose (#5204)
  force WAL sync after session create (#5202)
  Feat: goose Apify MCP integration docs (#5047)
  feat: enhance goose to search sessions for easy recall (#5177)
  Skip hidden & real format (#5194)
  docs: Hacktoberfest blog submission - Best Practices for Using Goose in Enterprise Environments by Anudhyan Datta. (#5184)
  docs: prompt injection detection (#5193)
  Fix mcp large response race condition (#5065)
  Compaction overhaul (#5186)
  fix: #3960 better approach to input schema for dynamic task params (#5189)
  ...
tlongwell-block added a commit that referenced this pull request Oct 18, 2025
* origin/main: (66 commits)
  Revert "Rewrite extension management tools" (#5243)
  Standardize Session Name Attribute (#5085)
  Docs: Include step-by-step model configuration instructions for first… (#5239)
  Delete message visibility filter (#5216)
  delete flaky pricing integration tests (#5207)
  chore: upgrade most npm packages to latest (#5185)
  Release/1.11.0 (#5224)
  Rewrite extension management tools (#5057)
  fix: re-sync package-lock.json (#5235)
  docs: Hacktoberfest MCP youtube short entry to community-content.json (#5150)
  feat: add schedule button to recipe entries (#5217)
  Autocompact threshold UI cleanup (#5232)
  fix: correct schema for openai tools (#5229)
  Break compaction back into check_ and do_ compaction (#5212)
  fix: revert built app name to uppercase Goose (#5206)
  feat: add Code Documentation Generator recipe (#5121) (#5125)
  Revert "feat: enhance goose to search sessions for easy recall (#5177)" (#5209)
  Blog: Best Practices for Prompt Engineering with goose (#5204)
  force WAL sync after session create (#5202)
  Feat: goose Apify MCP integration docs (#5047)
  ...
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

Successfully merging this pull request may close these issues.

Goose Session Panic on Startup

4 participants