# Help debugging Error: code: 100, message: 'UDF: Execution Error 1

**URL:** <https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359>\
**Category:** User Defined Functions (UDF)\
**Created:** [June 11, 2015, 6:27am UTC](https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359 "2015-06-11T06:27:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![denisbetsi](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@denisbetsi](https://discuss.aerospike.com/u/denisbetsi)\
**Post date:** [June 11, 2015, 6:27am UTC](https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359/1 "2015-06-11T06:27:34Z")

</div>

Can’t figure out what’s happening here and log file isn’t indicating anything useful.

Error:

```
scanAggregate Error: { code: 100, message: 'UDF: Execution Error 1', func: 'aerospike_query_foreach', file: 'src/main/aerospike/aerospike_query.c', line: 808 }

```

On my end using node.js as client. UDF file is:

```
local function starts_with(map,rec)
    if tostring(rec.tweet):find('%a+') ~= nil then
        map['tweets'] = map['tweets'] .. ',' .. tostring(rec.tweet)
    end
  return map
end

local function reduce_stats(a,b)
    a.tweets = a.tweets .. b.tweets
    return a
end

function find(stream,chars)
  return stream : aggregate(map{tweets='',chars=chars},starts_with) : reduce(reduce_stats)
end

```

Node.js code:

```
var statement = {aggregationUDF: {module: 'findtweet', funcname: 'find', args: ['please']}};
var query = client.query('test', 'tweets', statement);
var stream = query.execute();
stream.on('data', function(result) {
    var tweets = result.tweets.split(",").filter(function(e){return e});
    console.log('Tweets: ', tweets);
    console.log('Count: ', tweets.length);
});
stream.on('error', function(err) {
    console.log('scanAggregate Error: ',err);
});

```

And udf.log file contains many lines of the same thing which look like this:

```
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_free:448) [ENTER] NumUpdates(1) 
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_open:205) [ENTER] Opening record key:<Digest>:0xfd8fe98439939a0ecb4933f7994f69b84a9f20c0
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_storage_record_open:83) [ENTER] Opening record key:<Digest>:0xfd8fe98439939a0ecb4933f7994f69b84a9f20c0
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_get:687) [ENTER] rec(0x7f75acbb7280) name(tweet)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_get:424) [ENTER] BinName(tweet) 
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_set:481) [ENTER] urecord(0x7f75acbb7940) name(0x40f61938)[tweet] dirty(0)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_get:687) [ENTER] rec(0x7f75acbb7280) name(tweet)
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_get:424) [ENTER] BinName(tweet) 
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_close:266) [ENTER] Closing record key:<Digest>:0xfd8fe98439939a0ecb4933f7994f69b84a9f20c0
Jun 11 2015 06:25:56 GMT: DEBUG (udf): (udf_record.c:udf_record_cache_free:448) [ENTER] NumUpdates(1) 

```

Any ideas on whats going on here? I’ve simplified UDF file to just find any tweets that matches any word. Doesn’t matter what I search the end result is that error.

Have tried playing with the example provided here

> [@How to search bin values that contains or starts with the to be searched value](https://discuss.aerospike.com/t/how-to-search-bin-values-that-contains-or-starts-with-the-to-be-searched-value/985/3):
>
> Hi amitvengs, Depending on your application/use case Andrew’s suggestion is one way of going about it. If for some reason you are unable to limit the number of records first by way of creating a secondary index on a bin and applying equality or range filter on it, as of Aerospike Server release 3.4.1 you have the option to perform Scan Aggregations coupled with Streaming UDFs. They work very similar to Query Aggregations except you don’t apply any filter. In other words, Scan Aggregations will…

I am using test data from the online course.

---

<div class="post-metadata">

**Author:** ![gayathri](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@gayathri](https://discuss.aerospike.com/u/gayathri)\
**Post date:** [June 11, 2015, 7:13am UTC](https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359/2 "2015-06-11T07:13:42Z")

</div>

Hi Denisbetsi,

The UDF file must be available in the modlua-userPath location. This path can be set through the config while creating client object. This is query\_aggregate example which sets the path as follows. `modlua:{userPath: /path/to/lua/file}`[https://github.com/aerospike/aerospike-client-nodejs/blob/master/examples/query\_aggregate.js](https://github.com/aerospike/aerospike-client-nodejs/blob/master/examples/query_aggregate.js)

More details:

The map-reduce functions in the aggregation query runs the map-reduce functions inside each node in the cluster and returns the resultset to client. The client runs the final reduce job on the all those data returned. To run the final reduce on client, the client needs to be aware of the UDF/LUA file and that is specified using modlua:userPath in configuration object. This is the doc describing configuration object. [https://github.com/aerospike/aerospike-client-nodejs/blob/master/docs/configuration.md](https://github.com/aerospike/aerospike-client-nodejs/blob/master/docs/configuration.md)

Thanks

---

<div class="post-metadata">

**Author:** ![denisbetsi](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@denisbetsi](https://discuss.aerospike.com/u/denisbetsi)\
**Post date:** [June 11, 2015, 1:53pm UTC](https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359/3 "2015-06-11T13:53:00Z")

</div>

I loaded LUA files through the AMC. So if I have multiple projects using different UDF functions, in order to share the functions copy of each file must be inherited by each project?

---

<div class="post-metadata">

**Author:** ![gayathri](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@gayathri](https://discuss.aerospike.com/u/gayathri)\
**Post date:** [June 12, 2015, 9:13am UTC](https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359/4 "2015-06-12T09:13:28Z")

</div>

Yes. Copy of the file, containing the function you would like to execute must be available in modlua user path for that project. However you can have a common modlua userpath for all the projects and have all the UDF files in the path specified.

Thanks

---

<div class="post-metadata">

**Author:** ![denisbetsi](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@denisbetsi](https://discuss.aerospike.com/u/denisbetsi)\
**Post date:** [June 12, 2015, 12:49pm UTC](https://discuss.aerospike.com/t/help-debugging-error-code-100-message-udf-execution-error-1/1359/5 "2015-06-12T12:49:38Z")

</div>

Right for as long as projects operate from same file system. Otherwise there must be some sort of a central library that all projects inherit in case of a distributed processing network with multiple projects and developers.
