"AxiosError: Request failed with status code 400"

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:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 32.0.0
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04.3 LTS
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.58 (Ubuntu)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • 8.3.6
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • At least with this version, possibly before
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare metal using Hetzner's image. I staggered upates to the latest version and fine-tuned as indicated by the warnings.
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I am trying to set up email notifications. I am using Postmark as my email sender. I have entered in all the correct SMTP information. When I go to send a test email, I get met with “AxiosError: Request failed with status code 400.” I have searched quite a bit for a solution to this problem (including here on the forums). For most people, the answer seems to be “you didn’t put in a user email address.” However, i have done that and still get the same result. Not sure what the next steps would be to troubleshoot.

Steps to replicate it (hint: details matter!):

  1. As an admin, to “Basic Settings” and set up your Email Server.

  2. Make sure you have an email account for your admin user.

  3. Select “send test email.”

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

Nothing shows up in the administrative settings>logging logs around the time that I attempt to trigger this action.

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

N/A

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

Nothing appears to have shown up in this log, either.

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "[IP Address]",
            "[domain.tld]"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "32.0.0.13",
        "overwrite.cli.url": "https:\/\/[domain.tld]\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "loglevel": 2,
        "debug": false,
        "default_phone_region": "US",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "theme": "",
        "twofactor_enforced": "false",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "htaccess.RewriteBase": "\/",
        "maintenance_window_start": 5,
        "maintenance": false,
        "app_install_overwrite": [
            "tasks",
            "news",
            "end_to_end_encryption"
        ],
        "config_preset": 1,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtptimeout": 30,
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

Apps

The output of occ app:list (if possible).

Enabled:

  • activity: 5.0.0-dev.0
  • app_api: 32.0.0
  • bruteforcesettings: 5.0.0-dev.0
  • calendar: 6.0.0
  • circles: 32.0.0
  • cloud_federation_api: 1.16.0
  • comments: 1.22.0
  • contacts: 8.0.2
  • contactsinteraction: 1.13.1
  • dashboard: 7.12.0
  • dav: 1.34.2
  • end_to_end_encryption: 1.17.0
  • federatedfilesharing: 1.22.0
  • federation: 1.22.0
  • files: 2.4.0
  • files_downloadlimit: 5.0.0-dev.0
  • files_pdfviewer: 5.0.0-dev.0
  • files_reminders: 1.5.0
  • files_sharing: 1.24.0
  • files_trashbin: 1.22.0
  • files_versions: 1.25.0
  • firstrunwizard: 5.0.0-dev.0
  • forms: 5.2.0
  • logreader: 5.0.0-dev.0
  • lookup_server_connector: 1.20.0
  • news: 26.1.0
  • nextcloud_announcements: 4.0.0-dev.0
  • notes: 4.12.3
  • notifications: 5.0.0-dev.0
  • oauth2: 1.20.0
  • password_policy: 4.0.0-dev.0
  • photos: 5.0.0-dev.1
  • privacy: 4.0.0-dev.0
  • profile: 1.1.0
  • provisioning_api: 1.22.0
  • recognize: 10.0.4
  • recommendations: 5.0.0-dev.0
  • related_resources: 3.0.0-dev.0
  • richdocuments: 9.0.0
  • richdocumentscode: 25.4.504
  • serverinfo: 4.0.0-dev.0
  • settings: 1.15.1
  • sharebymail: 1.22.0
  • support: 4.0.0-dev.0
  • survey_client: 4.0.0-dev.0
  • systemtags: 1.22.0
  • tasks: 0.16.1
  • text: 6.0.0-dev.0
  • theming: 2.7.0
  • twofactor_backupcodes: 1.21.0
  • twofactor_nextcloud_notification: 6.0.0-dev.0
  • twofactor_totp: 14.0.0
  • twofactor_webauthn: 2.4.0
  • updatenotification: 1.22.0
  • user_status: 1.12.0
  • viewer: 5.0.0-dev.0
  • weather_status: 1.12.0
  • webhook_listeners: 1.3.0
  • workflowengine: 2.14.0
    Disabled:
  • admin_audit: 1.22.0
  • encryption: 2.20.0
  • files_external: 1.24.0
  • suspicious_login: 10.0.0-dev.0
  • user_ldap: 1.23.0

Tips for increasing the likelihood of a response

  • Use the preformatted text formatting option in the editor for all log entries and configuration output.
  • If screenshots are useful, feel free to include them.
    • If possible, also include key error output in text form so it can be searched for.
  • Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

I’ve never setup email before, but I have attempted to today and am facing this issue. I found another thread that suggested changing your config.php file to allow self-signed certificates (in my case, I do need this) but it hasn’t made any difference.

I’m using postal as my SMTP server, for what it’s worth

So did NC change the way it handles emails? Is it trying to use my personal account email (in this case, Tuta) as a provider instead of Postmark?

It’s not a real bug, but this error belongs to a “easy” admin profile managing that don’t require to setup an email address as a mandatory field.

The mail setup process requires a send from that cannot be empty. When you create a fresh instance of nextcloud, the email field of admin is empty and so the mail service setup fails.

Add it to the admin profile and it works.

For nextcloud developers:
I have used x-ai/grok-code-fast-1 to analyze the code and solve this issue in less than 5 minutes. Please use a better error description management to point sysadmin to the issue.

As stated in my first post, I have found numerous other posts online where people used the solution you suggested (“add an email to your admin user account”), however that’s not working for me. Unless I’m not putting it in the right place. Personal info page, right? Along with name, phone number, timezone, all that jazz? I’ve got my email address entered in there and nothing’s happening.

Hi @extra

Such issues need logs to be analysed, there might be a very specific issue with Postmark by example.

what does contains /var/www/nextcloud/data/nextcloud.log ?

How the web configuration is done ? Apache mod_php or php_fpm ? logs are not in same places. what does sudo systemctl list-units | grep php

I just discover Postmark with your post, so don’t nothing about this, but based on https://postmarkapp.com/developer/user-guide/send-email-with-smtp it seems a little different from classical SMPTP user/password. Is there any information in Postmark analytics ( 45 Days of Email Activity and Content Previews | Postmark ) ?

Once you collected more specific inforamtion, you might find the origin of the problem by yourself or post inforamtion heere to get more insights.

Regards

Meanwhile i went through reading [Bug]: Error setting up email server: AxiosError: Request failed with status code 400 · Issue #50845 · nextcloud/server · GitHub and it is stated about the fact that even with log level 0 debug there is not error loged at nextcloud server side. Some hints are given, like mail_smtpstreamoptions to specify certificate checking.

Hello all. Just to state I also have this issue in a new docker container deployment from the official container:latest. And, if you search for the AxiosError in the forum, there appear to be others as well. I have myself tried any number of combinations of None/STARTTLS and SSL with 587, 465 ports to no avail. I also tried with and without alias-E-mail address, no help either. It is therefor not possible to configure an account at this time. Cheers.