It sounds like you haven't been up-front about the nature of your work with the client from the beginning. I'm not sure from your question that you and your client understand that All software is buggy.
And I do mean all. Even your
HelloWorld app is "buggy" if it's expected it to ... I dunno ...
- Automatically translate based on locale settings
- Say "hello world" out loud for hearing impaired users
- Run on a toaster
- Other unreasonable things
Or even if it's expected to do something kinda reasonable that wasn't initially expected:
- Display "Hello World" visibly even when STDOUT is redirected to
Bugs are often just features as seen from another perspective. If there are delusions about this on either end, clear that up.
BUT FIRST, it's wise to apologize if any of the following are true:
- The bug is severe
- The bug is a result of some carelessness on your end
- If the client wasn't fully educated on your process, the nature of software, or the nature of bugs
- The client is very upset (even if it's not your fault)
What you do from there depends on your contract and desire to keep the client. If you bill by the hour, it's between you and the client as to whether it's billable time. That may require some investigation on your part before you can determine whether the issue was related to recent billable work. If it's a fixed price for completion of X, you should probably fix it for free. But, nothing is not beyond the realm of negotiation -- even if your in a contract.
Basically, have a conversation with the client and come to an agreement. Speak like humans. Ensure that you're giving the client's needs and expectations explicit consideration. Ensure, in as polite of a tone as possible, that the client also understands your needs in the relationship (to make a living) if profitability on the project is becoming questionable.
And if this is a common occurrence:
- Educate the client and agree on bug-fix and change-request procedures (and billing).
- Update your development and QA process.
- Update your attitude.
Your job is primarily to know what you're doing and deliver high quality work. If you don't have processes in place to ensure the client is getting a stable product, you need to fix that -- immediately. Secondly, but equally importantly, it's your job to politely educate the client when misunderstandings about the work, the product, or the process arise.
Imagine taking your car into the mechanic to replace a battery. Shortly after the replacement, you hear "funny noises" when you turn a corner. When you return with your car, your mechanic will (should) politely investigate the issue, explain the situation, and bill based on whether the newfound noise was related to the battery install.
He probably won't go to his buddies say, "I have a pathetic client", unless you've been truly unruly -- in which case, a good mechanic might offer a refund and recommend another mechanic.