"Attempt to remove an object that's already been removed from the stage or whose parent/ancestor group has already been removed."

So I’m working on a little game and when an object collides with another object it’s supposed to be removed from the stage. But when it collides, it throws up this error: 

"file: ERROR

ERROR: Attempt to remove an object that’s already been removed from the stage or whose parent/ancestor group has already been removed.

stack traceback:

    [C]: ?

    [C]: in function ‘removeSelf’

    ?: in function ‘remove’

    /Users/Admin/Dropbox/TunnelRunner/main.lua:326: in function </Users/Admin/Dropbox/TunnelRunner/main.lua:320>

    ?: in function <?:218>"

I’m on a Mac.

Here’s the code:

[lua]

function onCollision( event )

    if event.phase == “began” then

        display.remove( playerChar ) --this part is when the issue starts, I’ve tried playerChar:removeSelf() and the same issue occurs

        --Runtime:removeEventListener( “touch”, move )

        transition.cancel( moveObsTrans )

        --transition.cancel( moveObsTrans2 )

        display.remove( wall )

        --if i == 1 then

            --transition.cancel( moveObsTrans2 )

            --display.remove( wall1 )

        --end

        

        

        startButton = display.newImage( “playButton2.png” )

        startButton.x = display.contentWidth/2

        startButton.y = display.contentHeight/2.5

        

        startButtonText = display.newText( “Play!”, 0, 0, “Adventure”, 75)

        startButtonText:setTextColor( 0, 0, 0 )

        startButtonText.x = startButton.x

        startButtonText.y = startButton.y - 15

        

        controlButton = display.newImageRect( “playButton2.png”, 90, 45 )

        controlButton.x = display.contentWidth/2

        controlButton.y = display.contentHeight/1.5

        controlButton:setFillColor( 25, 80, 150 )

        

        controlButtonText = display.newText( “Controls”, 0, 0, “Adventure”, 20 )

        controlButtonText.x = controlButton.x

        controlButtonText.y = controlButton.y - 5

        startButton:addEventListener( “touch”, onStart )

        controlButton:addEventListener( “touch”, controls )

        Runtime:removeEventListener( “touch”, move )

    end

end

[/lua]

I’ve found that it does that with any object that gets hit, playerChar, wall, and wall1 all throw up the error it seems. wall and wall1 are removed earlier in the code when their move is completed  but in this case the move is canceled before then. This error only occurs when wall1 is in it. If it’s just wall then it works just fine. This function is the ONLY time playerChar is removed.

EDIT: Silly me! I accidentally assigned both wall1 and playerChar the eventListener for onCollision, it’s all fixed now.

Thank you rubber duck.