Skip to content

fix: resolve "Failed to get session title" error in packaged macOS app - #33

Merged
aiagentbuilder merged 2 commits into
DevAgentForge:mainfrom
tianrking:main
Jan 18, 2026
Merged

fix: resolve "Failed to get session title" error in packaged macOS app#33
aiagentbuilder merged 2 commits into
DevAgentForge:mainfrom
tianrking:main

Conversation

@tianrking

Copy link
Copy Markdown
Contributor

After packaging for macOS, the app would fail with "Failed to get session title" error when creating new sessions, preventing normal operation.

The issue was caused by accessing Electron's app.isPackaged property at module load time, which fails in the packaged environment:

  • export const claudeCodePath = getClaudeCodePath() was called during module initialization
  • app.getPath("userData") was called at module level in ipc-handlers.ts
  • app.on() event handlers were registered at module level in main.ts
  1. util.ts: Delay getClaudeCodePath() call to runtime within generateSessionTitle() function instead of module-level constant
  2. runner.ts: Use getClaudeCodePath() function call instead of importing constant
  3. ipc-handlers.ts: Delay sessions initialization with initializeSessions() function
  4. main.ts: Move event handler registration inside app.on("ready") callback
  5. Add comprehensive error handling with fallback to simple title generation
  • Update README.md and README_ZH.md to correct build commands (dist:mac-arm64 and dist:mac-x64 instead of non-existent dist:mac)

After packaging for macOS, the app would fail with "Failed to get session title"
error when creating new sessions, preventing normal operation.

The issue was caused by accessing Electron's `app.isPackaged` property at module
load time, which fails in the packaged environment:
- `export const claudeCodePath = getClaudeCodePath()` was called during module initialization
- `app.getPath("userData")` was called at module level in ipc-handlers.ts
- `app.on()` event handlers were registered at module level in main.ts

1. **util.ts**: Delay `getClaudeCodePath()` call to runtime within
   `generateSessionTitle()` function instead of module-level constant
2. **runner.ts**: Use `getClaudeCodePath()` function call instead of importing constant
3. **ipc-handlers.ts**: Delay sessions initialization with `initializeSessions()` function
4. **main.ts**: Move event handler registration inside `app.on("ready")` callback
5. Add comprehensive error handling with fallback to simple title generation

- Update README.md and README_ZH.md to correct build commands
  (dist:mac-arm64 and dist:mac-x64 instead of non-existent dist:mac)

Co-Authored-By: tian.r.king <tian.r.king@gmail.com>
@tianrking

Copy link
Copy Markdown
Contributor Author

hola ping @wksantiago @Pactortester

@tianrking

Copy link
Copy Markdown
Contributor Author

@aiagentbuilder

@aiagentbuilder
aiagentbuilder merged commit 67800a3 into DevAgentForge:main Jan 18, 2026
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.

2 participants