Too Many Arguments in Function Call

too many arguments in call to doSomething

Quick Answer

You are passing more arguments than the function accepts. Check the function signature and remove the extra arguments.

Why This Happens

Go enforces strict argument counts at compile time. If a function takes two parameters and you pass three, the compiler rejects it. This commonly happens after refactoring a function signature without updating all call sites.

The Problem

func add(a, b int) int {
    return a + b
}

func main() {
    result := add(1, 2, 3) // too many arguments
    fmt.Println(result)
}

The Fix

func add(a, b int) int {
    return a + b
}

func main() {
    result := add(1, 2)
    fmt.Println(result)
}

Step-by-Step Fix

  1. 1

    Identify the function

    Read the error to find which function has too many arguments.

  2. 2

    Check the signature

    Look at the function definition to see how many parameters it expects.

  3. 3

    Fix the call site

    Remove extra arguments or update the function signature to accept variadic arguments if needed.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free