Skip to content

fix(aws): don't panic on missing optional cluster_name in ECS log tools#237

Merged
rafeegnash merged 1 commit into
masterfrom
fix/ecs-cluster-name-panic
Jun 25, 2026
Merged

fix(aws): don't panic on missing optional cluster_name in ECS log tools#237
rafeegnash merged 1 commit into
masterfrom
fix/ecs-cluster-name-panic

Conversation

@rafeegnash

Copy link
Copy Markdown
Collaborator

Problem

analyze_ecs_service_logs and get_ecs_task_logs read cluster_name with a bare single-value type assertion (input["cluster_name"].(string)). The field is documented optional; when the LLM omits it, the map value is a nil interface and the assertion panics. The tool dispatcher runs inside goroutines with no recover(), so the panic crashes the whole process.

Where

  • internal/aws/llm.go:1871 (analyze_ecs_service_logs)
  • internal/aws/llm.go:1914 (get_ecs_task_logs)

Fix

Use the comma-ok form (clusterName, _ := input["cluster_name"].(string)); the existing if clusterName == "" { clusterName = "default" } fallback already handles the absent case — matching how service_name/task_arn are read two lines above.

Testing

go build ./internal/aws/ and go vet ./internal/aws/ pass. (A panic-regression unit test needs AWS-CLI mocking of executeAWSOperation; the fix is the standard comma-ok idiom and is self-contained.)

Closes #207

analyze_ecs_service_logs and get_ecs_task_logs read cluster_name with a
bare type assertion; when the LLM omits the documented-optional field the
value is a nil interface and the assertion panics. The dispatcher runs in
unrecovered goroutines, so the panic crashes the process. Use the
comma-ok form so the existing empty->default fallback handles it.

Closes #207
@rafeegnash
rafeegnash merged commit c58f910 into master Jun 25, 2026
5 checks passed
@rafeegnash
rafeegnash deleted the fix/ecs-cluster-name-panic branch June 25, 2026 08:12
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.

ECS log tools panic on missing optional cluster_name

1 participant