{"record":{"id":"0409ce29ea827bf3","repo":"langflow-ai/langflow","slug":"timestamp-is-required-when-requesting-logs-after-t","errorCode":null,"errorMessage":"Timestamp is required when requesting logs after the timestamp","messagePattern":"Timestamp is required when requesting logs after the timestamp","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"src/backend/base/langflow/api/log_router.py","lineNumber":98,"sourceCode":"):\n    \"\"\"Retrieve application logs with superuser authentication required.\n\n    SECURITY: Logs may contain sensitive information and require superuser authentication.\n    \"\"\"\n    global log_buffer  # noqa: PLW0602\n    if log_buffer.enabled() is False:\n        raise HTTPException(\n            status_code=HTTPStatus.NOT_IMPLEMENTED,\n            detail=\"Log retrieval is disabled\",\n        )\n    if lines_after > 0 and lines_before > 0:\n        raise HTTPException(\n            status_code=HTTPStatus.BAD_REQUEST,\n            detail=\"Cannot request logs before and after the timestamp\",\n        )\n    if timestamp <= 0:\n        if lines_after > 0:\n            raise HTTPException(\n                status_code=HTTPStatus.BAD_REQUEST,\n                detail=\"Timestamp is required when requesting logs after the timestamp\",\n            )\n        content = log_buffer.get_last_n(10) if lines_before <= 0 else log_buffer.get_last_n(lines_before)\n    elif lines_before > 0:\n        content = log_buffer.get_before_timestamp(timestamp=timestamp, lines=lines_before)\n    elif lines_after > 0:\n        content = log_buffer.get_after_timestamp(timestamp=timestamp, lines=lines_after)\n    else:\n        content = log_buffer.get_before_timestamp(timestamp=timestamp, lines=10)\n    return JSONResponse(content=content)\n","sourceCodeStart":80,"sourceCodeEnd":110,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/log_router.py#L80-L110","documentation":"HTTP 400 from GET /api/v1/logs when lines_after > 0 but no timestamp (or timestamp <= 0) is provided. Paging forward through logs requires an anchor point; without a timestamp the server cannot determine what 'after' means.","triggerScenarios":"Calling /api/v1/logs?lines_after=20 with timestamp omitted or set to 0.","commonSituations":"Log viewer 'load more' buttons that paginate forward but drop the timestamp parameter; default client SDKs sending 0-initialized timestamps.","solutions":["Include a positive timestamp when using lines_after, e.g. take the ts of the last displayed log line","If you want the most recent logs, use lines_before (or no params for the last 10) instead","Cache the timestamp of the newest line seen and pass it for the next forward page"],"exampleFix":"# before\nGET /api/v1/logs?lines_after=20  # 400\n# after\nGET /api/v1/logs?timestamp=1712345678&lines_after=20","handlingStrategy":"validation","validationCode":"function logQuery({ timestamp = 0, before = 0, after = 0 }) {\n  if (after > 0 && !(timestamp > 0)) throw new Error('timestamp required for lines_after');\n  return { timestamp, lines_before: before, lines_after: after };\n}","typeGuard":"const isValidForwardQuery = (q) => q.lines_after <= 0 || q.timestamp > 0;","tryCatchPattern":null,"preventionTips":["Always anchor forward pagination to the newest timestamp already displayed","Treat timestamp=0 as 'not provided', not as epoch","Omit unused params instead of sending 0 explicitly"],"tags":["logging","http-400","query-params"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}