diff --git a/lib/manager/npm/update/locked-dependency/yarn-lock/replace.ts b/lib/manager/npm/update/locked-dependency/yarn-lock/replace.ts
index f2e9adfc68d6bb0b444e650724fd83fe42a96619..7e09f3c83544425924f86cc677b2bca64d1ab427 100644
--- a/lib/manager/npm/update/locked-dependency/yarn-lock/replace.ts
+++ b/lib/manager/npm/update/locked-dependency/yarn-lock/replace.ts
@@ -1,3 +1,4 @@
+import { logger } from '../../../../../logger';
 import { regEx } from '../../../../../util/regex';
 
 export function replaceConstraintVersion(
@@ -16,6 +17,14 @@ export function replaceConstraintVersion(
   const matchString = `(${escaped}((",|,)[^\n:]+)?:\n)(.*\n)*?(\\s+dependencies|\n[@a-z])`;
   // yarn will fill in the details later
   const matchResult = regEx(matchString).exec(lockFileContent);
+  // istanbul ignore if
+  if (!matchResult) {
+    logger.debug(
+      { depName, constraint, newVersion },
+      'Could not find constraint in lock file'
+    );
+    return lockFileContent;
+  }
   let constraintLine = matchResult[1];
   if (newConstraint) {
     const newDepNameConstraint = `${depName}@${newConstraint}`;