Technical Forum
Ask questions. Discover Answers.
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri


I am working on automating SSL creation workflows with the python f5-sdk / iControl. I had the following set of code that was working last week, and as far as I know nothing changed since I'm the only one working on the big-ip. I've scoured the logs and but I can't find any further information about the error presented.


I am using the f5-sdk with the following code:

##This section of code works

mr.shared.file_transfer.uploads.upload_stringio(io.StringIO(request_obj['pkey']), '{0}.key'.format(domain))

mr.shared.file_transfer.uploads.upload_stringio(io.StringIO(request_obj['cert']), '{0}.crt'.format(domain))


I can then login to the Big-IP and `run /util bash`

>cd /var/config/rest/downloads

>ls tmp


However when I get to creating the certificate: = "", sourcePath="file:/var/config/rest/downloads/")


This line in particular - I am presented with the attached StackTrace.


iControlUnexpectedHTTPError        Traceback (most recent call last)

<ipython-input-39-a8ff9ebc3cca> in <module>

----> 1 = "", sourcePath="/var/config/rest/downloads/")


~/pyenvs/py37/lib/python3.7/site-packages/f5/bigip/ in create(self, **kwargs)

  1051         and state on the BIG-IP®.

  1052     """

-> 1053     return self._create(**kwargs)


  1055   def _check_load_parameters(self, **kwargs):


~/pyenvs/py37/lib/python3.7/site-packages/f5/bigip/ in _create(self, **kwargs)


  1014     # Invoke the REST operation on the device.

-> 1015     response =, json=kwargs, **requests_params)


  1017     # Make new instance of self


~/pyenvs/py37/lib/python3.7/site-packages/icontrol/ in wrapper(self, RIC_base_uri, **kwargs)

  293               response.url,

  294               response.text)

--> 295       raise iControlUnexpectedHTTPError(error_message, response=response)

  296     return response

  297   return wrapper


iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri:

Text: '{"code":400,"message":"Failed! exit_code (3).\\n","errorStack":[],"apiError":26214401}'



All of this code worked last week without issue. Any idea how to begin troubleshooting this error?


Hi Will,


Is there a previously installed certificate with name <>?

I think, if you using same name, you may encounter this error.

Unfortunately, I am getting this error even when creating new certificates. However using the same file with tmsh I can run the command and it works:


create sys file ssl-key /Common/ { source-path file:/var/config/rest/downloads/ }


I wonder if I can clear the icrd cache.

I tried restarting the whole big-ip, to no avail.

Hey  , I am also facing the same issue. Can you share how were you able to solve the issue?


Thought I would come back and it appears that many of my iControl issues have disappeared since upgrading to 0.0.4