You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
logSearch reports "No matches found" for a container that does not exist #142
When service names a container that does not exist, homelab_logSearch returns a successful "No matches found" instead of an error.
Where
mcp-server/src/tools/logSearch.ts:53, :59
Details
The single-service command is docker logs ... <service> 2>&1 | grep -i -e "$pat" | tail -N. The pipeline's exit status is that of tail (always 0). Docker's "No such container" message goes into grep through 2>&1 and is filtered out, so the handler sees empty output and reports no matches.
Impact
A typo in the container name, or a removed container, looks like "no errors in the logs", which is the wrong answer during an investigation. If the pattern matches the daemon message (the investigate-container prompt searches for error), the daemon error is returned as if it were a log line.
Steps to reproduce
Call homelab_logSearch with { "service": "grafanna", "pattern": "timeout" }
Result: No matches found ... instead of an error
Suggested fix
Check that the container exists first (docker inspect -f . <name> >/dev/null 2>&1 || { echo "No such container" >&2; exit 1; }), or use set -o pipefail and keep docker's stderr out of grep.
Acceptance criteria
Unknown container returns an error naming the container
Handler test covers the missing-container case
Getting started
Relevant files: mcp-server/src/tools/logSearch.ts
How to run tests: cd mcp-server && npm install && npm test (and npm run typecheck); structure tests: pip install -r requirements-test.txt && pytest tests/ -v
Conventions: see CLAUDE.md and CONTRIBUTING.md
Filed by repo-audit/full-audit at 636fefb. Severity: medium. Effort: S. audit-key: bug|mcp-server/src/tools/logSearch.ts|cmd
Fixed in b1c6c07: with service set, logSearch first runs docker inspect --type container and fails with 'No such container: ' instead of returning 'No matches found'. Verified with a handler test for the missing-container case; build, typecheck, Vitest and structure tests pass.
Activity
TMHSDigital commentedon Nov 19, 2026
Fixed in b1c6c07: with
serviceset, logSearch first runsdocker inspect --type containerand fails with 'No such container: ' instead of returning 'No matches found'. Verified with a handler test for the missing-container case; build, typecheck, Vitest and structure tests pass.fix: quote the container name in logSearch (#142)