From 2d5ffac56caf17db56e96b75fd1663ac04ae57c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sun, 23 Nov 2025 22:59:22 +0100 Subject: [PATCH] fix: correct readLog parameters for Supervisor XML-RPC API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed the readLog() call to use the correct parameters for reading from the end of the log file. When using a negative offset to read the last N bytes, the length parameter must be 0, not a positive number. Changes: - Updated fetchMainLog default length from 4096 to 0 - Updated API route default length from '4096' to '0' Correct usage: - readLog(-4096, 0) - Read last 4096 bytes from end of file - readLog(0, 4096) - Read 4096 bytes from start of file This fixes the INCORRECT_PARAMETERS error when fetching the main supervisord log. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/api/supervisor/logs/route.ts | 2 +- lib/hooks/useSupervisor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/supervisor/logs/route.ts b/app/api/supervisor/logs/route.ts index c5cc315..4e24ebc 100644 --- a/app/api/supervisor/logs/route.ts +++ b/app/api/supervisor/logs/route.ts @@ -7,7 +7,7 @@ export const dynamic = 'force-dynamic'; export const GET = withLogging(async (request: NextRequest) => { const searchParams = request.nextUrl.searchParams; const offset = parseInt(searchParams.get('offset') || '-4096', 10); - const length = parseInt(searchParams.get('length') || '4096', 10); + const length = parseInt(searchParams.get('length') || '0', 10); const client = createSupervisorClient(); const logs = await client.readLog(offset, length); diff --git a/lib/hooks/useSupervisor.ts b/lib/hooks/useSupervisor.ts index 695ccd3..adea52b 100644 --- a/lib/hooks/useSupervisor.ts +++ b/lib/hooks/useSupervisor.ts @@ -210,7 +210,7 @@ export function useRestartProcess() { // Log Management -async function fetchMainLog(offset: number = -4096, length: number = 4096): Promise<{ logs: string }> { +async function fetchMainLog(offset: number = -4096, length: number = 0): Promise<{ logs: string }> { const response = await fetch(`/api/supervisor/logs?offset=${offset}&length=${length}`); if (!response.ok) { const error = await response.json();