I suppose you have added the custom network in the metamask wallet . In the metamask wallet go to Settings >> Advanced and clear the data(Do this whenever you have redeployed the contract or restarted the blockchain node ). This will stop the error .
:)