Data 1 not used in evalscript's setup function

for the below posted request and evalscript, when i try to run it in the request builder, i receive the followinig error:

Data 1 not used in evalscript's setup function

what does error mean and it can be fixed please?

request:

{
  "input": {
	"bounds": {
	  "bbox": [
		12.44693,
		41.870072,
		12.541001,
		41.917096
	  ]
	},
	"data": [
	  {
		"dataFilter": {
		  "timeRange": {
			"from": "2024-05-04T00:00:00Z",
			"to": "2024-06-04T23:59:59Z"
		  }
		},
		"type": "sentinel-2-l2a"
	  },
	  {
		"dataFilter": {
		  "timeRange": {
			"from": "2024-05-04T00:00:00Z",
			"to": "2024-06-04T00:00:00Z"
		  }
		},
		"type": "sentinel-2-l2a"
	  }
	]
  },
  "output": {
	"width": 512,
	"height": 343.697,
	"responses": [
	  {
		"identifier": "averages",
		"format": {
		  "type": "image/tiff"
		}
	  },
	  {
		"identifier": "numOfCloudFreePixels",
		"format": {
		  "type": "image/tiff"
		}
	  }
	]
  },
  "evalscript": "//VERSION=3\n  // Script to extract a time series of NDVI values using \n  // Sentinel 2 Level 2A data and  metadata file.\n  \n  function setup() {\n    return {\n      input: [{\n        bands: [\"B04\", \"B08\", \"CLD\"],\n        units: \"DN\"\n      }],\n      output: [\n        {\n          id: \"averages\",\n          bands: 1,\n          sampleType: \"FLOAT32\",\n          nodataValue: NaN,\n        },\n        {\n          id: \"numOfCloudFreePixels\",\n          bands: 1,\n          sampleType: \"FLOAT32\",\n          nodataValue: NaN,\n        },\n      ],\n      mosaicking: Mosaicking.ORBIT\n    }\n  }\n\n  function updateOutput(output, collection) {\n    output.default.bands = collection.scenes.length\n  }\n\n  const cloudFreeSamples = [];\n  const cloudySamples = [];\n\n  function samplesParser(samples) {\n    samples.forEach((sample) => {\n      if (sample.CLD > 0) {\n        cloudySamples.push(sample);\n      } else {\n        cloudFreeSamples.push(sample);\n      }\n    });\n    return [cloudySamples, cloudFreeSamples];\n  }\n\n  function calcAverage(samples) {\n    let sum = 0;\n    for(let i = 0;i < samples.length; i++) {\n      sum += samples[i];\n    }\n    let avg = sum / samples.length;\n    return [avg];\n  }\n  function calcNDVIForCloudFreeSamples(samples) {\n    const ndvis = new Array(samples.length).fill(NaN);\n    samples.forEach((sample, index) => {\n      ndvis[index] = (sample.B08 - sample.B04) / (sample.B08 + sample.B04) ;\n    });\n    return ndvis;\n  }\n  function calcPercentage(total, incidences) {\n    return ((incidence / total) * 100);\n  }\n  function evaluatePixel(samples) {\n    if (samples.length < 1) return [NaN];\n    const parsedSamples = samplesParser(samples);\n    const ndvis = calcNDVIForCloudFreeSamples(parsedSamples[1]);\n    const averages = calcAverage(ndvis);\n    const numOfCloudyPixels = parsedSamples[0].length;\n    const numOfCloudFreePixels = parsedSamples[1].length;\n    const totalNumOfPixels = numOfCloudyPixels + numOfCloudFreePixels;\n    const percentageOfCloudy = calcPercentage(totalNumOfPixels, numOfCloudyPixels);\n    const percentageOfCloudFree = calcPercentage(totalNumOfPixels, numOfCloudFreePixels);\n\n    // return [averages, numOfCloudFreePixels, numOfCloudyPixels, percentageOfCloudFree, percentageOfCloudy];\n    return {\n      averages: averages,\n      numOfCloudFreePixels: numOfCloudFreePixels,\n    }\n  }"
}

evalscript:

//VERSION=3
  // Script to extract a time series of NDVI values using 
  // Sentinel 2 Level 2A data and  metadata file.
  
  function setup() {
	return {
	  input: [{
		bands: ["B04", "B08", "CLD"],
		units: "DN"
	  }],
	  output: [
		{
		  id: "averages",
		  bands: 1,
		  sampleType: "FLOAT32",
		  nodataValue: NaN,
		},
		{
		  id: "numOfCloudFreePixels",
		  bands: 1,
		  sampleType: "FLOAT32",
		  nodataValue: NaN,
		},
	  ],
	  mosaicking: Mosaicking.ORBIT
	}
  }

  function updateOutput(output, collection) {
	output.default.bands = collection.scenes.length
  }

  const cloudFreeSamples = [];
  const cloudySamples = [];

  function samplesParser(samples) {
	samples.forEach((sample) => {
	  if (sample.CLD > 0) {
		cloudySamples.push(sample);
	  } else {
		cloudFreeSamples.push(sample);
	  }
	});
	return [cloudySamples, cloudFreeSamples];
  }

  function calcAverage(samples) {
	let sum = 0;
	for(let i = 0;i < samples.length; i++) {
	  sum += samples[i];
	}
	let avg = sum / samples.length;
	return [avg];
  }
  function calcNDVIForCloudFreeSamples(samples) {
	const ndvis = new Array(samples.length).fill(NaN);
	samples.forEach((sample, index) => {
	  ndvis[index] = (sample.B08 - sample.B04) / (sample.B08 + sample.B04) ;
	});
	return ndvis;
  }
  function calcPercentage(total, incidences) {
	return ((incidence / total) * 100);
  }
  function evaluatePixel(samples) {
	if (samples.length < 1) return [NaN];
	const parsedSamples = samplesParser(samples);
	const ndvis = calcNDVIForCloudFreeSamples(parsedSamples[1]);
	const averages = calcAverage(ndvis);
	const numOfCloudyPixels = parsedSamples[0].length;
	const numOfCloudFreePixels = parsedSamples[1].length;
	const totalNumOfPixels = numOfCloudyPixels + numOfCloudFreePixels;
	const percentageOfCloudy = calcPercentage(totalNumOfPixels, numOfCloudyPixels);
	const percentageOfCloudFree = calcPercentage(totalNumOfPixels, numOfCloudFreePixels);

	return {
	  averages: averages,
	  numOfCloudFreePixels: numOfCloudFreePixels,
	}
  }

It seems like you have duplicated the input data, with 2 almost identical entries. Therefore the system thinks you are doing data fusion and requires an ID for each one.

I would suggest you remove one of them:

"data": [
      {
        "dataFilter": {
          "timeRange": {
            "from": "2024-05-04T00:00:00Z",
            "to": "2024-06-04T23:59:59Z"
          }
        },
        "type": "sentinel-2-l2a"
      }
    ]