diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index de75960ecc8f770e17dac12fbafbdbb2f908b744..19a7772258edf84b2d817d0810a08c81ab984e9a 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -272,8 +272,13 @@ static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     av_packet_unref(&filtered_packet);
 
     if (ret < 0) {
-        if (ctx->internal_error)
-            ret = ctx->internal_error;
+        goto error;
+    }
+
+    // cuvidParseVideoData doesn't return an error just because stuff failed...
+    if (ctx->internal_error) {
+        av_log(avctx, AV_LOG_ERROR, "cuvid decode callback error\n");
+        ret = ctx->internal_error;
         goto error;
     }