Skip to content

cloudagents: increase scanner buffer to avoid token too long errors#903

Open
c-tonneslan wants to merge 1 commit into
livekit:mainfrom
c-tonneslan:fix/scanner-buffer-overflow
Open

cloudagents: increase scanner buffer to avoid token too long errors#903
c-tonneslan wants to merge 1 commit into
livekit:mainfrom
c-tonneslan:fix/scanner-buffer-overflow

Conversation

@c-tonneslan
Copy link
Copy Markdown

Fixes livekit/livekit-cli#822.

bufio.Scanner has a default max token size of 64KB. Docker build output and agent logs can exceed this, particularly during package installs like pip, which causes lk agent deploy --silent to crash with:

bufio.Scanner: token too long

Bump the max to 4MB in both the build status scanner (build.go) and the log streaming scanner (logs.go). The initial buffer stays at the default 64KB — we're just raising the ceiling for lines that need more.

bufio.Scanner defaults to a 64KB max token size. Docker build output
and agent logs can produce lines longer than that, especially during
package installs (e.g. pip), causing "bufio.Scanner: token too long".

Bump the max to 4MB in both the build and log scanners. This matches
what lk agent deploy --silent users hit in practice.
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.

agent deploy --silent fails with 'bufio.Scanner: token too long' during Docker build

1 participant