tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Troubleshooting

PDF
Focus Mode
Font Size
Last updated: 2024-02-01 18:01:21

Overview

When an SDK call fails, the result information is included in the cos_status_t structure returned by the API.
The correct way to use each API in the SDK is as follows. For simplicity, the document includes only samples of API usage but not specific exception troubleshooting.
cos_status_t *s = NULL;
s = cos_put_object_from_file(options, &bucket, &object, &file, &headers, &resp_headers);
if (!s && !cos_status_is_ok(s)) {
// Output logs of exceptions and process as needed
cos_warn_log("failed to put object from file", buf);
if (s->error_code) cos_warn_log("status->error_code: %s", s->error_code);
if (s->error_msg) cos_warn_log("status->error_msg: %s", s->error_msg);
if (s->req_id) cos_warn_log("status->req_id: %s", s->req_id);
}

Client Exceptions

When the code member value in the cos_status_t structure is below 0, an SDK client error has occurred. For the error codes and messages, see the definition of cos_error_code_e.
typedef enum {
COSE_OK = 0,
COSE_OUT_MEMORY = -1000,
COSE_OVER_MEMORY = -999,
COSE_FAILED_CONNECT = -998,
COSE_ABORT_CALLBACK = -997,
COSE_INTERNAL_ERROR = -996,
COSE_REQUEST_TIMEOUT = -995,
COSE_INVALID_ARGUMENT = -994,
COSE_INVALID_OPERATION = -993,
COSE_CONNECTION_FAILED = -992,
COSE_FAILED_INITIALIZE = -991,
COSE_NAME_LOOKUP_ERROR = -990,
COSE_FAILED_VERIFICATION = -989,
COSE_WRITE_BODY_ERROR = -988,
COSE_READ_BODY_ERROR = -987,
COSE_SERVICE_ERROR = -986,
COSE_OPEN_FILE_ERROR = -985,
COSE_FILE_SEEK_ERROR = -984,
COSE_FILE_INFO_ERROR = -983,
COSE_FILE_READ_ERROR = -982,
COSE_FILE_WRITE_ERROR = -981,
COSE_XML_PARSE_ERROR = -980,
COSE_UTF8_ENCODE_ERROR = -979,
COSE_CRC_INCONSISTENT_ERROR = -978,
COSE_FILE_FLUSH_ERROR = -977,
COSE_FILE_TRUNC_ERROR = -976,
COSE_UNKNOWN_ERROR = -100
} cos_error_code_e;

Server Exceptions

When the code member value in the cos_status_t structure is above 0, a network error has occurred.
The cos_status_t structure is described as follows:
cos_status_t Member
Description
Type
code
Status code in the response. 4xx indicates that the request failed due to a client exception. 5xx indicates that the request failed due to a server exception. For more information, see Error Codes.
Int
error_code
Error code returned by the body when the request fails. For more information, see Error Codes.
String
error_msg
Error message returned by the body when the request fails. For more information, see Error Codes.
String
req_id
Request ID used to uniquely identify the request.
String


Using the Diagnosis Tool

COS provides a self-help diagnosis tool to help you quickly locate request problems and debug code.

Directions

1. Copy the request ID (RequestId) returned when the request error occurs.
2. Click Diagnosis Tool.

3. Enter RequestId and click Diagnose.
4. Wait and view the diagnostic result.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback