Error showing in current page id in wordpress admin

While front–end of the site always has a post context (you are either looking at one or archive of posts), admin side doesn’t.

So plenty of admin screens won’t have $post global set to anything. You should be checking if it’s meaningful (for example by if ( ! empty( $post ) )) before trying to access it.