# Hash\_hkdf(): Argument #2 ($key) cannot be empty

**URL:** <https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556>\
**Category:** ℹ️ Support\
**Tags:** github\_issue\_exists, nc28\
**Created:** [May 16, 2024, 5:57am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556 "2024-05-16T05:57:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![onlyscience](https://help.nextcloud.com/letter_avatar/onlyscience/32/5_5575768a8748004e209b776fc1b2916d.png) [@onlyscience](https://help.nextcloud.com/u/onlyscience)\
**Post date:** [May 16, 2024, 5:57am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556/1 "2024-05-16T05:57:52Z")

</div>

> **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 ❤

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

```auto

```

---

<div class="post-metadata">

**Author:** ![Dennis\_Wiss](https://help.nextcloud.com/user_avatar/help.nextcloud.com/dennis_wiss/32/61803_2.png) [@Dennis\_Wiss](https://help.nextcloud.com/u/Dennis_Wiss)\
**Post date:** [May 18, 2024, 9:44am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556/2 "2024-05-18T09:44:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![azcn2503](https://help.nextcloud.com/user_avatar/help.nextcloud.com/azcn2503/32/49222_2.png) [@azcn2503](https://help.nextcloud.com/u/azcn2503)\
**Post date:** [May 24, 2024, 10:43am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556/3 "2024-05-24T10:43:30Z")

</div>

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:

```auto
{
  "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.

---

<div class="post-metadata">

**Author:** ![Fjalar](https://help.nextcloud.com/letter_avatar/fjalar/32/5_5575768a8748004e209b776fc1b2916d.png) [@Fjalar](https://help.nextcloud.com/u/Fjalar)\
**Post date:** [August 27, 2024, 9:25am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556/4 "2024-08-27T09:25:48Z")

</div>

Same Problem with 29.0.3, php8.2

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/5_5575768a8748004e209b776fc1b2916d.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [August 27, 2024, 9:34am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556/5 "2024-08-27T09:34:51Z")

</div>

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

> <https://github.com/nextcloud/server/issues/34012>
>
> \### ⚠️ This issue respects the following points: ⚠️
> 
> \- \[X\] This is a \*\*bug\*\*, …not a question or a configuration/webserver/proxy issue.
> \- \[X\] This issue is \*\*not\*\* already reported on Github \_(I've searched it)\_.
> \- \[X\] Nextcloud Server \*\*is\*\* up to date. See \[Maintenance and Release Schedule\](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
> \- \[X\] Nextcloud Server \*\*is\*\* running on 64bit capable CPU, PHP and OS.
> \- \[X\] I agree to follow Nextcloud's \[Code of Conduct\](https://nextcloud.com/contribute/code-of-conduct/).
> 
> \### Bug description
> 
> After upgrading my server from Nextcloud v24.0.4 to v24.0.5 and also upgrading to PHP8 (I don't know if this is of importance), the Nextcloud cron job generates the following error output:
> 
> \`\`\`
> ValueError: hash\_hkdf(): Argument #2 ($key) cannot be empty in .../lib/private/Security/Crypto.php:97
> Stack trace:
> \#0 .../nextcloud/lib/private/Security/Crypto.php(97): hash\_hkdf('sha512', '')
> \#1 .../nextcloud/lib/private/Security/IdentityProof/Manager.php(110): OC\\Security\\Crypto-\>encrypt('-----BEGIN PRIV...')
> \#2 .../nextcloud/lib/private/Security/IdentityProof/Manager.php(133): OC\\Security\\IdentityProof\\Manager-\>generateKey('user-juergen')
> \#3 .../nextcloud/lib/private/Security/IdentityProof/Manager.php(146): OC\\Security\\IdentityProof\\Manager-\>retrieveKey('user-juergen')
> \#4 .../nextcloud/lib/private/Security/IdentityProof/Signer.php(64): OC\\Security\\IdentityProof\\Manager-\>getKey(Object(OC\\User\\User))
> \#5 .../nextcloud/apps/lookup\_server\_connector/lib/BackgroundJobs/RetryJob.php(150): OC\\Security\\IdentityProof\\Signer-\>sign('lookupserver', Array, Object(OC\\User\\User))
> \#6 .../nextcloud/lib/public/BackgroundJob/Job.php(79): OCA\\LookupServerConnector\\BackgroundJobs\\RetryJob-\>run(Array)
> \#7 .../nextcloud/apps/lookup\_server\_connector/lib/BackgroundJobs/RetryJob.php(113): OCP\\BackgroundJob\\Job-\>execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))
> \#8 .../nextcloud/cron.php(151): OCA\\LookupServerConnector\\BackgroundJobs\\RetryJob-\>execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))
> \#9 {main}
> \`\`\`
> 
> \### Steps to reproduce
> 
> I don't know how to reproduce it at the moment but it seems to occur if notification should be send-out.
> 
> \### Expected behavior
> 
> Execute background job without running into an error condition.
> 
> \### Installation method
> 
> Community Manual installation with Archive
> 
> \### Operating system
> 
> \_No response\_
> 
> \### PHP engine version
> 
> PHP 8.0
> 
> \### Web server
> 
> Apache (supported)
> 
> \### Database engine version
> 
> MariaDB
> 
> \### Is this bug present after an update or on a fresh install?
> 
> Updated from a minor version (ex. 22.2.3 to 22.2.4)
> 
> \### Are you using the Nextcloud Server Encryption module?
> 
> Encryption is Disabled
> 
> \### What user-backends are you using?
> 
> \- \[X\] Default user-backend \_(database)\_
> \- \[\] LDAP/ Active Directory
> \- \[\] SSO - SAML
> \- \[\] Other
> 
> \### Configuration report
> 
> \`\`\`shell
> \## Environment
> \#### Server Configuration
> OS: Linux 5.15.64
> Web server: Apache2 2.4.53
> Database: MariaDB 10.3.35
> PHP version: 8.0.20
> Nextcloud version: 24.0.5
> 
> \#### Client Configuration
> Browser: Mozilla Firefox 104.0.2
> Operating system: Windows 10
> \`\`\`
> 
> 
> \### List of activated Apps
> 
> \`\`\`shell
> Enabled:
> - accessibility: 1.10.0
> - activity: 2.16.0
> - admin\_audit: 1.14.0
> - announcementcenter: 6.3.1
> - apporder: 0.15.0
> - audioplayer: 3.3.0
> - bookmarks: 11.0.1
> - bruteforcesettings: 2.4.0
> - calendar: 3.5.0
> - circles: 24.0.1
> - cloud\_federation\_api: 1.7.0
> - comments: 1.14.0
> - contacts: 4.2.0
> - contactsinteraction: 1.5.0
> - dav: 1.22.0
> - event\_update\_notification: 1.5.0
> - external: 4.0.0
> - federatedfilesharing: 1.14.0
> - federation: 1.14.0
> - files: 1.19.0
> - files\_accesscontrol: 1.14.1
> - files\_antivirus: 3.3.1
> - files\_automatedtagging: 1.14.0
> - files\_downloadactivity: 1.13.0
> - files\_external: 1.16.1
> - files\_pdfviewer: 2.5.0
> - files\_photospheres: 1.24.1
> - files\_retention: 1.13.2
> - files\_rightclick: 1.3.0
> - files\_sharing: 1.16.2
> - files\_trashbin: 1.14.0
> - files\_versions: 1.17.0
> - files\_videoplayer: 1.13.0
> - firstrunwizard: 2.13.0
> - groupfolders: 12.0.1
> - guests: 2.2.0
> - impersonate: 1.11.0
> - logreader: 2.9.0
> - lookup\_server\_connector: 1.12.0
> - mail: 1.13.8
> - maps: 0.2.1
> - metadata: 0.16.0
> - news: 18.1.1
> - nextcloud\_announcements: 1.13.0
> - notes: 4.5.1
> - notifications: 2.12.1
> - notify\_push: 0.4.0
> - oauth2: 1.12.0
> - password\_policy: 1.14.0
> - photos: 1.6.0
> - previewgenerator: 5.0.0
> - privacy: 1.8.0
> - provisioning\_api: 1.14.0
> - serverinfo: 1.14.0
> - settings: 1.6.0
> - sharebymail: 1.14.0
> - smb\_test: 0.3.4
> - spreed: 14.0.4
> - suspicious\_login: 4.2.0
> - systemtags: 1.14.0
> - tasks: 0.14.4
> - text: 3.5.1
> - theming: 1.15.0
> - twofactor\_backupcodes: 1.13.0
> - twofactor\_gateway: 0.20.0
> - twofactor\_totp: 6.4.0
> - twofactor\_webauthn: 0.3.1
> - unsplash: 1.2.5
> - updatenotification: 1.14.0
> - user\_status: 1.4.0
> - viewer: 1.8.0
> - workflow\_script: 1.9.0
> - workflowengine: 2.6.0
> Disabled:
> - dashboard: 7.0.0
> - encryption
> - epubreader: 1.4.7
> - files\_trackdownloads: 1.11.0
> - recommendations: 0.6.0
> - support: 1.4.0
> - survey\_client: 1.1.0
> - twofactor\_admin: 3.2.0
> - user\_ldap
> - weather\_status: 1.0.0
> \`\`\`
> 
> 
> \### Nextcloud Signing status
> 
> \`\`\`shell
> No errors have been found.
> \`\`\`
> 
> 
> \### Nextcloud Logs
> 
> \`\`\`shell
> .
> \`\`\`
> 
> 
> \### Additional info
> 
> .

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [January 16, 2025, 8:21am UTC](https://help.nextcloud.com/t/hash-hkdf-argument-2-key-cannot-be-empty/192556/6 "2025-01-16T08:21:54Z")

</div>


