Skip to content

Fix startup panic when Code Mode is disabled#90

Merged
christianromeni merged 1 commit into
voidmind-io:mainfrom
SAY-5:fix/codemode-schemattl-nil-panic
May 13, 2026
Merged

Fix startup panic when Code Mode is disabled#90
christianromeni merged 1 commit into
voidmind-io:mainfrom
SAY-5:fix/codemode-schemattl-nil-panic

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 12, 2026

Copy link
Copy Markdown
Contributor

Problem

VoidLLM panics at startup with a nil pointer dereference whenever Code Mode is not explicitly enabled:

panic: runtime error: invalid memory address or nil pointer dereference
github.com/voidmind-io/voidllm/internal/app.New(...)
	/app/internal/app/app.go:759
main.main()
	/app/cmd/voidllm/main.go:85

Fixes #87.

Cause

app.New builds codeModeService unconditionally and does schemaTTL: *cfg.Settings.MCP.CodeMode.SchemaTTL. But setDefaults only assigns SchemaTTL a default when CodeMode.IsEnabled() is true, so the pointer is nil in the (default) disabled case and the dereference panics.

Fix

Dereference SchemaTTL only when it is non-nil, falling back to a zero time.Duration otherwise. The Code Mode entrypoints on the service are not registered/reachable when Code Mode is disabled, so the value is unused in that path.

Test plan

  • Added TestSetDefaults_SchemaTTL_NilWhenCodeModeDisabled in internal/config documenting that SchemaTTL stays nil when Code Mode is disabled (the precondition this fix tolerates).
  • go test ./internal/config/ ./internal/app/ passes; go vet clean. (internal/app requires ui/dist built per CONTRIBUTING; with that present the package builds and tests pass.)

app.New unconditionally dereferenced cfg.Settings.MCP.CodeMode.SchemaTTL,
but setDefaults only assigns it a value when Code Mode is enabled, so the
pointer is nil otherwise and the process panics at startup. Fall back to a
zero TTL when the pointer is nil; the Code Mode entrypoints on the service
are not reachable in that configuration.
@snyk-io

snyk-io Bot commented May 12, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/app/app.go 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@christianromeni christianromeni merged commit d89ef5f into voidmind-io:main May 13, 2026
6 of 7 checks passed
@christianromeni christianromeni mentioned this pull request May 13, 2026
2 tasks
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.

[Bug] Panic at startup: nil pointer dereference in internal/app/app.go:759 when Code Mode is disabled

2 participants