If this check fails, `error` should be set.