# The directory item limit of /tmp/aggregate\_intermediates is exceeded: limit=1048576 items=1048576

**URL:** <https://discuss.hail.is/t/the-directory-item-limit-of-tmp-aggregate-intermediates-is-exceeded-limit-1048576-items-1048576/3610>\
**Category:** Hail Query & hailctl\
**Created:** [October 13, 2023, 4:25pm UTC](https://discuss.hail.is/t/the-directory-item-limit-of-tmp-aggregate-intermediates-is-exceeded-limit-1048576-items-1048576/3610 "2023-10-13T16:25:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgarcia](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mgarcia](https://discuss.hail.is/u/mgarcia)\
**Post date:** [October 13, 2023, 4:25pm UTC](https://discuss.hail.is/t/the-directory-item-limit-of-tmp-aggregate-intermediates-is-exceeded-limit-1048576-items-1048576/3610/1 "2023-10-13T16:25:24Z")

</div>

Hello Hail Team,

I am in the process of running our hail-based sample quality control script on roughly 470,000 exomes on the UK Biobank Research Analysis Platform. While running a test, my job failed due to the following error:

```python
hail.utils.java.FatalError: RemoteException: The directory item limit of /tmp/aggregate_intermediates is exceeded: limit=1048576 items=1048576
        at org.apache.hadoop.hdfs.server.namenode.FSDirectory.verifyMaxDirItems(FSDirectory.java:1277)
        at org.apache.hadoop.hdfs.server.namenode.FSDirectory.addLastINode(FSDirectory.java:1361)
        at org.apache.hadoop.hdfs.server.namenode.FSDirectory.addINode(FSDirectory.java:1184)
        at org.apache.hadoop.hdfs.server.namenode.FSDirWriteFileOp.addFile(FSDirWriteFileOp.java:579)
        at org.apache.hadoop.hdfs.server.namenode.FSDirWriteFileOp.startFile(FSDirWriteFileOp.java:398)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFileInt(FSNamesystem.java:2703)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.startFile(FSNamesystem.java:2596)
        at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.create(NameNodeRpcServer.java:799)
        at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.create(ClientNamenodeProtocolServerSideTranslatorPB.java:494)
        at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
        at org.apache.hadoop.ipc.ProtobufRpcEngine2$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine2.java:604)
        at org.apache.hadoop.ipc.ProtobufRpcEngine2$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine2.java:572)
        at org.apache.hadoop.ipc.ProtobufRpcEngine2$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine2.java:556)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1093)
        at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:1043)
        at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:971)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1878)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2976)

```

I saw this [thread](https://discuss.hail.is/t/aggregate-intermediates-in-tmp-dir-filling-up/2768) indicating that the individual solved this error by “manually removing the contents of aggregate\_intermediates”. What exactly does that mean, and can you provide deeper insight into how that can be done? Thank you in advance.

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [October 13, 2023, 5:10pm UTC](https://discuss.hail.is/t/the-directory-item-limit-of-tmp-aggregate-intermediates-is-exceeded-limit-1048576-items-1048576/3610/2 "2023-10-13T17:10:20Z")

</div>

Hey @mgarcia !

You could manually issue an `rm -rf /tmp/aggregate_intermediates` but I think an easier, more scalable, and durable fix is to set your tmp\_dir to a S3 bucket: `hl.init(tmp_dir='s3://...')`. Or, perhaps, a DNANexus bucket/table? I’m not too familiar with the DNANexus platform.
