Error while trying to download image files from sentinel 2

# Configure Sentinel Hub with your credentials
config = SHConfig()
config.sh_client_id = 'xxxxx
config.sh_client_secret = 'xxxxxx'

# Evalscript for computing NBR
evalscript = """
// Evaluate pixel function to compute NBR
function evaluatePixel(samples) {
    // Access NIR and SWIR bands
    var nir = samples.B08; // NIR band
    var swir = samples.B11; // SWIR band
    // Calculate NBR
    var nbr = (nir - swir) / (nir + swir);

    return {
        default: [nbr] // Return NBR value

// Setup for input and output
var setup = {
    input: [{
        bands: ['B08', 'B11'], // Bands required for NBR calculation (NIR and SWIR)
        units: 'DN' // Specify units of input bands
    output: {
        bands: 1, // Number of output bands (NBR)
        sampleType: 'FLOAT32' // Sample type of output
# Function to download satellite imagery from Sentinel Hub
def download_satellite_imagery(bbox, time_interval, output_folder):
    # Define the request
    request = SentinelHubRequest(
            SentinelHubRequest.output_response('default', MimeType.TIFF)
      #  resolution = (0.0010, 0.0010) ,
        data_folder=output_folder,  # Specify the output folder where data should be saved
    # Execute the request and save the downloaded imagery
    img_paths = request.get_data(save_data=True)
    # Return the path of the downloaded imagery
    return img_paths[0]
Error : 400 Client Error: Bad Request for url: Server response: "{"status": 400, "reason": "Bad Request", "message": "Script failed to return.", "code": "RENDERER_EXCEPTION"}"

Please , I’m new to this and need some help in figuring out where I went wrong ,I am using sentinel hub python API for this , I have given my evalscript and download function where the error is occurring. I have cross checked my client id and secret details , they seem to be fine , previously I got resolution errors , after reducing resolution , I am getting this specific error. I am trying to compute NBR using 2 bands of sentinel for pre and post fire dates , I have specified the bbox coordinates as well as the download folder path individually for pre and post fire.

Hi, it was an issue with the evalscript you were using. Do you know where you sourced it from?

If you insert the below evalscript, your request should work:


function evaluatePixel(samples) {
    let val = index(samples.B08, samples.B12);
    return [val, samples.dataMask];

function setup() {
  return {
    input: [{
      bands: [
    output: {
      bands: 2

hello william , thanks for your quick reply , yeah it seems the issue was indeed with the eval script , I have leveraged chat gpt 3.5 for this , as I am still learning things. I am now able to successfully download the required band’s data , thank you.