All Products
Search
Document Center

Object Storage Service:What do I do if the "Connect to oss failed: [Errno -2] Name or service not known" error message appears when I upload resources to OSS?

Last Updated:Oct 31, 2025

Problem description

The "Connect to oss failed: [Errno -2] Name or service not known" error message appears when you upload resources to OSS.

Causes

The error is reported due to one of the following reasons:

  • The endpoint that you specify is invalid.

  • The DNS server cannot work as expected.

Solutions

  1. Check whether the endpoint that you specify is valid. For more information, see Regions and endpoints.

  2. Check whether domain name resolution is normal. You can ping the OSS domain name on the server for testing, such as ping shj-test.oss-cn-hangzhou.aliyuncs.com. You can also run the nslookup command to view the resolution details.

Applicable scope

  • OSS