Repository navigation
Can not parse request #787
Copy link
Copy link
Open
Labels
SDKIssue pertains to the SDK itself and not specific to any serviceIssue pertains to the SDK itself and not specific to any service
Description
import oci
config = oci.config.from_file()
compute_client = oci.core.ComputeClient(config)
compartment_id = "ocid1.compartment.oc1..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
launch_details = oci.core.models.LaunchInstanceDetails(
availability_domain="EU-FRANKFURT-1-AD-3",
compartment_id=compartment_id,
shape="VM.Standard.A1.Flex",
display_name="Server",
source_details=oci.core.models.InstanceSourceViaImageDetails(
source_type="image",
image_id="ocid1.image.oc1.eu-frankfurt-1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
),
create_vnic_details=oci.core.models.CreateVnicDetails(
subnet_id="ocid1.subnet.oc1.eu-frankfurt-1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
assign_public_ip=True,
assign_private_dns_record=True
),
shape_config=oci.core.models.LaunchInstanceShapeConfigDetails(
memory_in_gbs=24,
ocpus=4
),
metadata={
"ssh_authorized_keys": open(r"/path/to/ssh-key.pub").read().strip()
},
agent_config=oci.core.models.LaunchInstanceAgentConfigDetails(
is_management_disabled=False,
is_monitoring_disabled=False,
plugins_config=[
{"name": "Vulnerability Scanning", "desired_state": "DISABLED"},
{"name": "Management Agent", "desired_state": "DISABLED"},
{"name": "Custom Logs Monitoring", "desired_state": "ENABLED"},
{"name": "Compute RDMA GPU Monitoring", "desired_state": "DISABLED"},
{"name": "Compute Instance Monitoring", "desired_state": "ENABLED"},
{"name": "Compute HPC RDMA Auto-Configuration", "desired_state": "DISABLED"},
{"name": "Compute HPC RDMA Authentication", "desired_state": "DISABLED"},
{"name": "Cloud Guard Workload Protection", "desired_state": "ENABLED"},
{"name": "Block Volume Management", "desired_state": "DISABLED"},
{"name": "Bastion", "desired_state": "DISABLED"}
]
),
instance_options=oci.core.models.InstanceOptions(
are_legacy_imds_endpoints_disabled=False
),
availability_config=oci.core.models.LaunchInstanceAvailabilityConfigDetails(
recovery_action="RESTORE_INSTANCE"
)
)
response = compute_client.launch_instance(launch_details)
print("Launch initiated. Instance ID:", response.data.id)
oci.wait_until(
compute_client,
compute_client.get_instance(response.data.id),
'lifecycle_state',
'RUNNING',
max_wait_seconds=600
)
print("Instance is now RUNNING")
input()oci.exceptions.ServiceError: {
'target_service': 'compute',
'status': 400,
'code': 'CannotParseRequest',
'opc-request-id': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'message': 'Incorrectly formatted request. Please refer to our documentation for help.',
'operation_name': 'launch_instance',
'timestamp': '2025-08-13T15:29:34.585459+00:00',
'client_version': 'Oracle-PythonSDK/2.157.1',
'request_endpoint': 'POST https://iaas.eu-frankfurt-1.oraclecloud.com/20160918/instances',
'logging_tips': 'Refer to https://docs.oracle.com/en-us/iaas/tools/python/latest/logging.html for ways to log request/response details.',
'troubleshooting_tips': 'See https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_400__400_cannotparserequest and https://docs.oracle.com/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance for more info.'
}
Metadata
Metadata
Assignees
Labels
SDKIssue pertains to the SDK itself and not specific to any serviceIssue pertains to the SDK itself and not specific to any service
Activity