I have a script tool in ArcGIS Pro v3.3 to loop through a geodatabase of polygon feature classes and intersect each of them with another polygon dataset and then do some additional processing. Of the 14 intersect layers 12 of them work perfectly but two of them are throwing error 000840 (Value is not a feature layer). I cannot find any differences between the polygon layers that work and the 2 that throw the error. If I add a step to Make a Feature Layer to the script I get the same error, that the input is not (already) a feature layer. Any suggestions?
workSpace = arcpy.GetParameterAsText(0)
pestGDB = arcpy.GetParameterAsText(1)
inputFC = arcpy.GetParameterAsText(2)
bufferDist = arcpy.GetParameterAsText(3)
workingGDB = os.path.join(str(pestGDB) + ".gdb")
projectBuffer = os.path.join(workingGDB, os.path.basename(inputFC) + "_PEST_RESULTS")
arcpy.analysis.Buffer(inputFC, projectBuffer, bufferDist)
pestLayers = os.path.join(workSpace, os.path.basename("PEST_Inputs.gdb"))
arcpy.env.workspace = pestLayers
pestList = arcpy.ListFeatureClasses()
for fc in pestList:
intersectResults = os.path.join(workingGDB, "intersect_" + str(fc))
arcpy.analysis.Intersect([projectBuffer, fc], intersectResults)