Hash_hkdf(): Argument #2 ($key) cannot be empty

Support intro

I know there is a bug #34012, but it is closed, I read everything and I cannot understand what I should do to solve the issue. I have the secret in the config.php, the proble persist. What is the solution?

Thank you

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version : 28.0.5
Operating system and version Ubuntu 22.04.04 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.52
PHP version (eg, 7.4): 8.1

The issue you are facing:
Continuous error in the log
hash_hkdf(): Argument #2 ($key) cannot be empty

Error while running background job (class: OCA\DAV\BackgroundJob\EventReminderJob, arguments: )

Is this the first time you’ve seen this error? (Y/N):
N
Steps to replicate it:
Nothing special, they are always there

I have exactly the same issue. Do not understand it. It is constantly in the log.

I am experiencing the same thing.

It only seems to affect files uploading from iOS. I can upload files to my Nextcloud instance just fine using the web browser. In the iOS app this manifests as an error toast with the title “Upload file” and the description “unknown error”.

The full error including stack trace for me is:

{
  "reqId": "Vt70v05rvbDPMZdZLG6w",
  "level": 3,
  "time": "2024-05-24T10:33:56+00:00",
  "remoteAddr": "192.168.86.227",
  "user": "aaron",
  "app": "no app in context",
  "method": "POST",
  "url": "/ocs/v2.php/apps/notifications/api/v2/push",
  "message": "hash_hkdf(): Argument #2 ($key) cannot be empty in file '/app/www/public/lib/private/Security/Crypto.php' line 149",
  "userAgent": "Mozilla/5.0 (iOS) Nextcloud-iOS/5.2.7",
  "version": "29.0.0.19",
  "exception": {
    "Exception": "Exception",
    "Message": "hash_hkdf(): Argument #2 ($key) cannot be empty in file '/app/www/public/lib/private/Security/Crypto.php' line 149",
    "Code": 0,
    "Trace": [
      {
        "file": "/app/www/public/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/app/www/public/lib/private/Route/Router.php",
        "line": 338,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/app/www/public/ocs/v1.php",
        "line": 66,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/app/www/public/ocs/v2.php",
        "line": 23,
        "args": ["/app/www/public/ocs/v1.php"],
        "function": "require_once"
      }
    ],
    "File": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 170,
    "Previous": {
      "Exception": "ValueError",
      "Message": "hash_hkdf(): Argument #2 ($key) cannot be empty",
      "Code": 0,
      "Trace": [
        {
          "file": "/app/www/public/lib/private/Security/Crypto.php",
          "line": 149,
          "function": "hash_hkdf"
        },
        {
          "file": "/app/www/public/lib/private/Security/Crypto.php",
          "line": 123,
          "function": "decryptWithoutSecret",
          "class": "OC\\Security\\Crypto",
          "type": "->",
          "args": ["*** sensitive parameters replaced ***"]
        },
        {
          "file": "/app/www/public/lib/private/Security/IdentityProof/Manager.php",
          "line": 116,
          "function": "decrypt",
          "class": "OC\\Security\\Crypto",
          "type": "->",
          "args": ["*** sensitive parameters replaced ***"]
        },
        {
          "file": "/app/www/public/lib/private/Security/IdentityProof/Manager.php",
          "line": 133,
          "function": "retrieveKey",
          "class": "OC\\Security\\IdentityProof\\Manager",
          "type": "->"
        },
        {
          "file": "/config/www/nextcloud/apps/notifications/lib/Controller/PushController.php",
          "line": 134,
          "function": "getKey",
          "class": "OC\\Security\\IdentityProof\\Manager",
          "type": "->"
        },
        {
          "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 232,
          "function": "registerDevice",
          "class": "OCA\\Notifications\\Controller\\PushController",
          "type": "->"
        },
        {
          "file": "/app/www/public/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 138,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/app/www/public/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/app/www/public/lib/private/Route/Router.php",
          "line": 338,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/app/www/public/ocs/v1.php",
          "line": 66,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/app/www/public/ocs/v2.php",
          "line": 23,
          "args": ["/app/www/public/ocs/v1.php"],
          "function": "require_once"
        }
      ],
      "File": "/app/www/public/lib/private/Security/Crypto.php",
      "Line": 149
    },
    "message": "hash_hkdf(): Argument #2 ($key) cannot be empty in file '/app/www/public/lib/private/Security/Crypto.php' line 149",
    "exception": [],
    "CustomMessage": "hash_hkdf(): Argument #2 ($key) cannot be empty in file '/app/www/public/lib/private/Security/Crypto.php' line 149"
  },
  "id": "66506d79c5b01"
}

I can see that in my config.php, the secret is set and this value has never changed since installation about a year ago. Perhaps the value isn’t making it all the way through the various functions in that stack trace.

Same Problem with 29.0.3, php8.2

There is an issue regarding this on GitHub, maybe the information in the comments are of any help…